A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pkg.go.dev/github.com/openai/openai-go below:

openai package - github.com/openai/openai-go - Go Packages

Equals "chatgpt-4o-latest"

Equals "codex-mini-latest"

Equals "gpt-3.5-turbo"

Equals "gpt-3.5-turbo-0125"

Equals "gpt-3.5-turbo-0301"

Equals "gpt-3.5-turbo-0613"

Equals "gpt-3.5-turbo-1106"

Equals "gpt-3.5-turbo-16k"

Equals "gpt-3.5-turbo-16k-0613"

Equals "gpt-4"

Equals "gpt-4-turbo"

Equals "gpt-4-turbo-2024-04-09"

Equals "gpt-4-turbo-preview"

Equals "gpt-4-vision-preview"

Equals "gpt-4-0125-preview"

Equals "gpt-4-0314"

Equals "gpt-4-0613"

Equals "gpt-4.1"

Equals "gpt-4-1106-preview"

Equals "gpt-4.1-mini"

Equals "gpt-4.1-mini-2025-04-14"

Equals "gpt-4.1-nano"

Equals "gpt-4.1-nano-2025-04-14"

Equals "gpt-4.1-2025-04-14"

Equals "gpt-4-32k"

Equals "gpt-4-32k-0314"

Equals "gpt-4-32k-0613"

Equals "gpt-4o"

Equals "gpt-4o-2024-05-13"

Equals "gpt-4o-2024-08-06"

Equals "gpt-4o-2024-11-20"

Equals "gpt-4o-audio-preview"

Equals "gpt-4o-audio-preview-2024-10-01"

Equals "gpt-4o-audio-preview-2024-12-17"

Equals "gpt-4o-audio-preview-2025-06-03"

Equals "gpt-4o-mini"

Equals "gpt-4o-mini-2024-07-18"

Equals "gpt-4o-mini-audio-preview"

Equals "gpt-4o-mini-audio-preview-2024-12-17"

Equals "gpt-4o-mini-search-preview"

Equals "gpt-4o-mini-search-preview-2025-03-11"

Equals "gpt-4o-search-preview"

Equals "gpt-4o-search-preview-2025-03-11"

Equals "o1"

Equals "o1-mini"

Equals "o1-mini-2024-09-12"

Equals "o1-preview"

Equals "o1-preview-2024-09-12"

Equals "o1-2024-12-17"

Equals "o3"

Equals "o3-mini"

Equals "o3-mini-2025-01-31"

Equals "o3-2025-04-16"

Equals "o4-mini"

Equals "o4-mini-2025-04-16"

Equals "eq"

Equals "gt"

Equals "gte"

Equals "lt"

Equals "lte"

Equals "ne"

Equals "and"

Equals "or"

Equals "high"

Equals "low"

Equals "medium"

Equals "auto"

Equals "concise"

Equals "detailed"

Equals "auto"

Equals "concise"

Equals "detailed"

Equals "computer-use-preview"

Equals "computer-use-preview-2025-03-11"

Equals "o1-pro"

Equals "o1-pro-2025-03-19"

Equals "o3-deep-research"

Equals "o3-deep-research-2025-06-26"

Equals "o3-pro"

Equals "o3-pro-2025-06-10"

Equals "o4-mini-deep-research"

Equals "o4-mini-deep-research-2025-06-26"

This section is empty.

DefaultClientOptions read from the environment (OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID, OPENAI_WEBHOOK_SECRET, OPENAI_BASE_URL). This should be used to initialize new clients.

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.

Use the following switch statement to find the correct variant

switch variant := AnnotationDeltaUnion.AsAny().(type) {
case openai.FileCitationDeltaAnnotation:
case openai.FilePathDeltaAnnotation:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := AnnotationUnion.AsAny().(type) {
case openai.FileCitationAnnotation:
case openai.FilePathAnnotation:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

type Assistant struct {
	
	ID string `json:"id,required"`
	
	CreatedAt int64 `json:"created_at,required"`
	
	Description string `json:"description,required"`
	
	
	Instructions string `json:"instructions,required"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,required"`
	
	
	
	
	
	Model string `json:"model,required"`
	
	Name string `json:"name,required"`
	
	Object constant.Assistant `json:"object,required"`
	
	
	
	Tools []AssistantToolUnion `json:"tools,required"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ResponseFormat AssistantResponseFormatOptionUnion `json:"response_format,nullable"`
	
	
	
	Temperature float64 `json:"temperature,nullable"`
	
	
	
	
	ToolResources AssistantToolResources `json:"tool_resources,nullable"`
	
	
	
	
	
	TopP float64 `json:"top_p,nullable"`
	
	JSON struct {
		ID             respjson.Field
		CreatedAt      respjson.Field
		Description    respjson.Field
		Instructions   respjson.Field
		Metadata       respjson.Field
		Model          respjson.Field
		Name           respjson.Field
		Object         respjson.Field
		Tools          respjson.Field
		ResponseFormat respjson.Field
		Temperature    respjson.Field
		ToolResources  respjson.Field
		TopP           respjson.Field
		ExtraFields    map[string]respjson.Field
		
	} `json:"-"`
}

Represents an `assistant` that can call the model and use tools.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

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.Overrides()

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

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.

Use the following switch statement to find the correct variant

switch variant := AssistantStreamEventUnion.AsAny().(type) {
case openai.AssistantStreamEventThreadCreated:
case openai.AssistantStreamEventThreadRunCreated:
case openai.AssistantStreamEventThreadRunQueued:
case openai.AssistantStreamEventThreadRunInProgress:
case openai.AssistantStreamEventThreadRunRequiresAction:
case openai.AssistantStreamEventThreadRunCompleted:
case openai.AssistantStreamEventThreadRunIncomplete:
case openai.AssistantStreamEventThreadRunFailed:
case openai.AssistantStreamEventThreadRunCancelling:
case openai.AssistantStreamEventThreadRunCancelled:
case openai.AssistantStreamEventThreadRunExpired:
case openai.AssistantStreamEventThreadRunStepCreated:
case openai.AssistantStreamEventThreadRunStepInProgress:
case openai.AssistantStreamEventThreadRunStepDelta:
case openai.AssistantStreamEventThreadRunStepCompleted:
case openai.AssistantStreamEventThreadRunStepFailed:
case openai.AssistantStreamEventThreadRunStepCancelled:
case openai.AssistantStreamEventThreadRunStepExpired:
case openai.AssistantStreamEventThreadMessageCreated:
case openai.AssistantStreamEventThreadMessageInProgress:
case openai.AssistantStreamEventThreadMessageDelta:
case openai.AssistantStreamEventThreadMessageCompleted:
case openai.AssistantStreamEventThreadMessageIncomplete:
case openai.AssistantStreamEventErrorEvent:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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.

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.

type AssistantStreamEventUnionDataIncompleteDetails struct {
	Reason string `json:"reason"`
	JSON   struct {
		Reason respjson.Field
		
	} `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.

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.

type AssistantStreamEventUnionDataUsage struct {
	CompletionTokens int64 `json:"completion_tokens"`
	PromptTokens     int64 `json:"prompt_tokens"`
	TotalTokens      int64 `json:"total_tokens"`
	JSON             struct {
		CompletionTokens respjson.Field
		PromptTokens     respjson.Field
		TotalTokens      respjson.Field
		
	} `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.

Specifies a tool the model should use. Use to force the model to call a specific tool.

Returns the unmodified JSON received from the API

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.Overrides()

Returns the unmodified JSON received from the API

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.Overrides()

type AssistantToolChoiceFunctionParam struct {
	
	Name string `json:"name,required"`
	
}

The property Name is required.

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.

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]

Returns the unmodified JSON received from the API

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.Overrides()

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Specifies a tool the model should use. Use to force the model to call a specific tool.

The property Type is required.

type AssistantToolChoiceType string

The type of the tool. If type is `function`, the function name must be set

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.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type AssistantToolResourcesFileSearch struct {
	
	
	
	
	VectorStoreIDs []string `json:"vector_store_ids"`
	
	JSON struct {
		VectorStoreIDs respjson.Field
		ExtraFields    map[string]respjson.Field
		
	} `json:"-"`
}

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := AssistantToolUnion.AsAny().(type) {
case openai.CodeInterpreterTool:
case openai.FileSearchTool:
case openai.FunctionTool:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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.Overrides()

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

const (
	AudioModelWhisper1            AudioModel = "whisper-1"
	AudioModelGPT4oTranscribe     AudioModel = "gpt-4o-transcribe"
	AudioModelGPT4oMiniTranscribe AudioModel = "gpt-4o-mini-transcribe"
)
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`.

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.

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 AudioSpeechNewParamsResponseFormat string

The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.

type AudioSpeechNewParamsStreamFormat string

The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`.

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).

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.

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.

Generates audio from the input text.

type AudioTranscriptionNewParams struct {
	
	
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	
	
	
	Model AudioModel `json:"model,omitzero,required"`
	
	
	
	Language param.Opt[string] `json:"language,omitzero"`
	
	
	
	
	Prompt param.Opt[string] `json:"prompt,omitzero"`
	
	
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	
	ChunkingStrategy AudioTranscriptionNewParamsChunkingStrategyUnion `json:"chunking_strategy,omitzero"`
	
	
	
	
	
	Include []TranscriptionInclude `json:"include,omitzero"`
	
	
	
	
	
	ResponseFormat AudioResponseFormat `json:"response_format,omitzero"`
	
	
	
	
	
	
	
	TimestampGranularities []string `json:"timestamp_granularities,omitzero"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type AudioTranscriptionNewParamsChunkingStrategyVadConfig struct {
	
	
	
	Type string `json:"type,omitzero,required"`
	
	PrefixPaddingMs param.Opt[int64] `json:"prefix_padding_ms,omitzero"`
	
	
	
	SilenceDurationMs param.Opt[int64] `json:"silence_duration_ms,omitzero"`
	
	
	
	Threshold param.Opt[float64] `json:"threshold,omitzero"`
	
}

The property Type is required.

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.

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.

Transcribes audio into the input language.

Transcribes audio into the input language.

type AudioTranslationNewParamsResponseFormat string

The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.

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.

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.

Translates audio into English.

type AutoFileChunkingStrategyParam struct {
	
	Type constant.Auto `json:"type,required"`
	
}

The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.

This struct has a constant value, construct it with NewAutoFileChunkingStrategyParam.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type BatchListParams struct {
	
	
	
	
	After param.Opt[string] `query:"after,omitzero" json:"-"`
	
	
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	
}
type BatchNewParamsCompletionWindow string

The time frame within which the batch should be processed. Currently only `24h` is supported.

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.

The request counts for different statuses within the batch.

Returns the unmodified JSON received from the API

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.

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.

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.

List your organization's batches.

List your organization's batches.

Creates and executes a batch from an uploaded file of requests

The current status of the batch.

type BetaAssistantListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

type BetaAssistantNewParams struct {
	
	
	
	
	
	Model shared.ChatModel `json:"model,omitzero,required"`
	
	Description param.Opt[string] `json:"description,omitzero"`
	
	
	Instructions param.Opt[string] `json:"instructions,omitzero"`
	
	Name param.Opt[string] `json:"name,omitzero"`
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	
	
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
	
	
	
	
	
	
	
	ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
	
	
	
	
	ToolResources BetaAssistantNewParamsToolResources `json:"tool_resources,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"`
	
	
	
	Tools []AssistantToolUnionParam `json:"tools,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.

type BetaAssistantNewParamsToolResourcesCodeInterpreter struct {
	
	
	
	FileIDs []string `json:"file_ids,omitzero"`
	
}

The properties Static, Type are required.

type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct {
	
	
	
	ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
	
	
	MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
	
}

The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

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.

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.

Returns a list of assistants.

Returns a list of assistants.

Create an assistant with a model and instructions.

type BetaAssistantUpdateParams struct {
	
	Description param.Opt[string] `json:"description,omitzero"`
	
	
	Instructions param.Opt[string] `json:"instructions,omitzero"`
	
	Name param.Opt[string] `json:"name,omitzero"`
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	
	
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
	
	
	
	
	
	
	
	ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
	
	
	
	
	ToolResources BetaAssistantUpdateParamsToolResources `json:"tool_resources,omitzero"`
	
	
	
	
	
	Model BetaAssistantUpdateParamsModel `json:"model,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"`
	
	
	
	Tools []AssistantToolUnionParam `json:"tools,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.

type BetaAssistantUpdateParamsToolResourcesCodeInterpreter struct {
	
	
	
	
	FileIDs []string `json:"file_ids,omitzero"`
	
}
type BetaAssistantUpdateParamsToolResourcesFileSearch struct {
	
	
	
	
	VectorStoreIDs []string `json:"vector_store_ids,omitzero"`
	
}

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.

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 BetaThreadMessageListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type BetaThreadMessageNewParamsRole string

The role of the entity that is creating the message. Allowed values include:

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.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

Deletes a message.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Retrieve a message.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Returns a list of messages for a given thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Returns a list of messages for a given thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Create a message.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Modifies a message.

Deprecated: The Assistants API is deprecated in favor of the Responses API

type BetaThreadMessageUpdateParams struct {
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
}
type BetaThreadNewAndRunParams added in v1.1.0
type BetaThreadNewAndRunParams struct {
	
	
	
	AssistantID string `json:"assistant_id,required"`
	
	
	Instructions param.Opt[string] `json:"instructions,omitzero"`
	
	
	
	
	
	MaxCompletionTokens param.Opt[int64] `json:"max_completion_tokens,omitzero"`
	
	
	
	
	
	MaxPromptTokens param.Opt[int64] `json:"max_prompt_tokens,omitzero"`
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	
	
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	
	
	
	ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
	
	
	
	Model shared.ChatModel `json:"model,omitzero"`
	
	
	
	
	ToolResources BetaThreadNewAndRunParamsToolResources `json:"tool_resources,omitzero"`
	
	
	Tools []AssistantToolUnionParam `json:"tools,omitzero"`
	
	
	TruncationStrategy BetaThreadNewAndRunParamsTruncationStrategy `json:"truncation_strategy,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"`
	
	
	Thread BetaThreadNewAndRunParamsThread `json:"thread,omitzero"`
	
	
	
	
	
	
	
	ToolChoice AssistantToolChoiceOptionUnionParam `json:"tool_choice,omitzero"`
	
}
func (BetaThreadNewAndRunParams) MarshalJSON added in v1.1.0 type BetaThreadNewAndRunParamsThread added in v1.1.0

Options to create a new thread. If no thread is provided when running a request, an empty thread will be created.

func (BetaThreadNewAndRunParamsThread) MarshalJSON added in v1.1.0 func (*BetaThreadNewAndRunParamsThread) UnmarshalJSON added in v1.1.0 type BetaThreadNewAndRunParamsThreadToolResources added in v1.1.0

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) MarshalJSON added in v1.1.0 func (*BetaThreadNewAndRunParamsThreadToolResources) UnmarshalJSON added in v1.1.0 type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic added in v1.1.0
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct {
	
	
	
	ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
	
	
	MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
	
}

The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.

func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON added in v1.1.0 func (*BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) UnmarshalJSON added in v1.1.0 type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion added in v1.1.0

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic added in v1.1.0

Returns a pointer to the underlying variant's property, if present.

func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType added in v1.1.0

Returns a pointer to the underlying variant's property, if present.

func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON added in v1.1.0 func (*BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) UnmarshalJSON added in v1.1.0 type BetaThreadNewAndRunParamsToolResources added in v1.1.0

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) MarshalJSON added in v1.1.0 func (*BetaThreadNewAndRunParamsToolResources) UnmarshalJSON added in v1.1.0 type BetaThreadNewAndRunParamsTruncationStrategy added in v1.1.0
type BetaThreadNewAndRunParamsTruncationStrategy struct {
	
	
	
	
	
	
	Type string `json:"type,omitzero,required"`
	
	
	LastMessages param.Opt[int64] `json:"last_messages,omitzero"`
	
}

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) MarshalJSON added in v1.1.0 func (*BetaThreadNewAndRunParamsTruncationStrategy) UnmarshalJSON added in v1.1.0

The properties Content, Role are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

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.

type BetaThreadNewParamsToolResourcesCodeInterpreter struct {
	
	
	
	FileIDs []string `json:"file_ids,omitzero"`
	
}

The properties Static, Type are required.

type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct {
	
	
	
	ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
	
	
	MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
	
}

The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

type BetaThreadRunListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

type BetaThreadRunNewParams struct {
	
	
	
	AssistantID string `json:"assistant_id,required"`
	
	
	
	AdditionalInstructions param.Opt[string] `json:"additional_instructions,omitzero"`
	
	
	
	Instructions param.Opt[string] `json:"instructions,omitzero"`
	
	
	
	
	
	MaxCompletionTokens param.Opt[int64] `json:"max_completion_tokens,omitzero"`
	
	
	
	
	
	MaxPromptTokens param.Opt[int64] `json:"max_prompt_tokens,omitzero"`
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	
	
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	
	
	
	ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
	
	AdditionalMessages []BetaThreadRunNewParamsAdditionalMessage `json:"additional_messages,omitzero"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
	
	
	
	Model shared.ChatModel `json:"model,omitzero"`
	
	
	
	
	
	
	
	
	ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
	
	
	Tools []AssistantToolUnionParam `json:"tools,omitzero"`
	
	
	TruncationStrategy BetaThreadRunNewParamsTruncationStrategy `json:"truncation_strategy,omitzero"`
	
	
	
	
	
	
	
	Include []RunStepInclude `query:"include,omitzero" json:"-"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"`
	
	
	
	
	
	
	
	ToolChoice AssistantToolChoiceOptionUnionParam `json:"tool_choice,omitzero"`
	
}

The properties Content, Role are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type BetaThreadRunNewParamsTruncationStrategy struct {
	
	
	
	
	
	
	Type string `json:"type,omitzero,required"`
	
	
	LastMessages param.Opt[int64] `json:"last_messages,omitzero"`
	
}

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.

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.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

Cancels a run that is `in_progress`.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Retrieves a run.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Returns a list of runs belonging to a thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Returns a list of runs belonging to a thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Create a run.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Create a run.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Modifies a run.

Deprecated: The Assistants API is deprecated in favor of the Responses API

type BetaThreadRunStepGetParams struct {
	
	
	
	
	
	
	
	Include []RunStepInclude `query:"include,omitzero" json:"-"`
	
}
type BetaThreadRunStepListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

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.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

Retrieves a run step.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Returns a list of run steps belonging to a run.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Returns a list of run steps belonging to a run.

Deprecated: The Assistants API is deprecated in favor of the Responses API

type BetaThreadRunSubmitToolOutputsParamsToolOutput struct {
	
	Output param.Opt[string] `json:"output,omitzero"`
	
	
	ToolCallID param.Opt[string] `json:"tool_call_id,omitzero"`
	
}
type BetaThreadRunUpdateParams struct {
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
}

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.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

Delete a thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Retrieves a thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Create a thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

func (*BetaThreadService) NewAndRun deprecated added in v1.1.0

Create a thread and run it in one request.

Deprecated: The Assistants API is deprecated in favor of the Responses API

func (*BetaThreadService) NewAndRunStreaming deprecated added in v1.1.0

Create a thread and run it in one request.

Deprecated: The Assistants API is deprecated in favor of the Responses API

Modifies a thread.

Deprecated: The Assistants API is deprecated in favor of the Responses API

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.

type BetaThreadUpdateParamsToolResourcesCodeInterpreter struct {
	
	
	
	FileIDs []string `json:"file_ids,omitzero"`
	
}
type BetaThreadUpdateParamsToolResourcesFileSearch struct {
	
	
	
	
	VectorStoreIDs []string `json:"vector_store_ids,omitzero"`
	
}

Represents a chat completion response returned by model, based on the provided input.

Returns the unmodified JSON received from the API

Helper to accumulate chunks from a stream

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.

JustFinishedContent retrieves the chat completion content 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.

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.

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.

Messages sent by the model in response to user messages.

The property Role is required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type ChatCompletionAssistantMessageParamFunctionCall struct {
	
	
	
	
	Arguments string `json:"arguments,required"`
	
	Name string `json:"name,required"`
	
}

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.

type ChatCompletionAudioParamFormat string

Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, or `pcm16`.

type ChatCompletionAudioParamVoice string

The voice the model uses to respond. Supported voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, and `shimmer`.

Returns the unmodified JSON received from the API

Log probability information for the choice.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

A chat completion delta generated by streamed model responses.

Returns the unmodified JSON received from the API

Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.

Deprecated: deprecated

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Log probability information for the choice.

Returns the unmodified JSON received from the API

type ChatCompletionChunkServiceTier string

Specifies the processing type used for serving the request.

When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

type ChatCompletionContentPartFileFileParam struct {
	
	
	FileData param.Opt[string] `json:"file_data,omitzero"`
	
	FileID param.Opt[string] `json:"file_id,omitzero"`
	
	Filename param.Opt[string] `json:"filename,omitzero"`
	
}

Learn about [image inputs](https://platform.openai.com/docs/guides/vision).

Returns the unmodified JSON received from the API

ToParam converts this ChatCompletionContentPartImage to a ChatCompletionContentPartImageParam.

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 ChatCompletionContentPartImageParam.Overrides()

Returns the unmodified JSON received from the API

type ChatCompletionContentPartImageImageURLParam struct {
	
	URL string `json:"url,required" format:"uri"`
	
	
	
	
	Detail string `json:"detail,omitzero"`
	
}

The property URL is required.

type ChatCompletionContentPartInputAudioInputAudioParam struct {
	
	Data string `json:"data,required"`
	
	
	
	Format string `json:"format,omitzero,required"`
	
}

The properties Data, Format are required.

type ChatCompletionContentPartRefusalParam struct {
	
	Refusal string `json:"refusal,required"`
	
	
	
	Type constant.Refusal `json:"type,required"`
	
}

The properties Refusal, Type are required.

Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).

Returns the unmodified JSON received from the API

ToParam converts this ChatCompletionContentPartText to a ChatCompletionContentPartTextParam.

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 ChatCompletionContentPartTextParam.Overrides()

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns the unmodified JSON received from the API

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.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type ChatCompletionFunctionCallOptionParam struct {
	
	Name string `json:"name,required"`
	
}

Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.

The property Name is required.

type ChatCompletionFunctionMessageParam struct {
	
	Content param.Opt[string] `json:"content,omitzero,required"`
	
	Name string `json:"name,required"`
	
	
	
	Role constant.Function `json:"role,required"`
	
}

Deprecated: deprecated

The properties Content, Name, Role are required.

type ChatCompletionListParamsOrder string

Sort order for Chat Completions by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.

A chat completion message generated by the model.

Returns the unmodified JSON received from the API

A URL citation when using web search.

Returns the unmodified JSON received from the API

A URL citation when using web search.

Returns the unmodified JSON received from the API

Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.

Deprecated: deprecated

Returns the unmodified JSON received from the API

type ChatCompletionMessageListParamsOrder string

Sort order for messages by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.

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"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

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.

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.

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.

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.

Returns the unmodified JSON received from the API

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.Overrides()

The function that the model called.

Returns the unmodified JSON received from the API

type ChatCompletionMessageToolCallFunctionParam struct {
	
	
	
	
	Arguments string `json:"arguments,required"`
	
	Name string `json:"name,required"`
	
}

The function that the model called.

The properties Arguments, Name are required.

The properties ID, Function, Type are required.

type ChatCompletionNamedToolChoiceFunctionParam struct {
	
	Name string `json:"name,required"`
	
}

The property Name is required.

Specifies a tool the model should use. Use to force the model to call a specific function.

The properties Function, Type are required.

type ChatCompletionNewParams struct {
	
	
	
	
	
	
	Messages []ChatCompletionMessageParamUnion `json:"messages,omitzero,required"`
	
	
	
	
	
	Model shared.ChatModel `json:"model,omitzero,required"`
	
	
	
	FrequencyPenalty param.Opt[float64] `json:"frequency_penalty,omitzero"`
	
	
	
	Logprobs param.Opt[bool] `json:"logprobs,omitzero"`
	
	
	
	MaxCompletionTokens param.Opt[int64] `json:"max_completion_tokens,omitzero"`
	
	
	
	
	
	
	
	MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"`
	
	
	
	N param.Opt[int64] `json:"n,omitzero"`
	
	
	
	PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"`
	
	
	
	
	
	Seed param.Opt[int64] `json:"seed,omitzero"`
	
	
	
	
	
	Store param.Opt[bool] `json:"store,omitzero"`
	
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"`
	
	
	
	
	
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	
	
	
	ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
	
	
	
	PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
	
	
	
	
	
	SafetyIdentifier param.Opt[string] `json:"safety_identifier,omitzero"`
	
	
	
	
	
	User param.Opt[string] `json:"user,omitzero"`
	
	
	
	Audio ChatCompletionAudioParam `json:"audio,omitzero"`
	
	
	
	
	
	
	
	
	LogitBias map[string]int64 `json:"logit_bias,omitzero"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	Modalities []string `json:"modalities,omitzero"`
	
	
	
	
	
	
	
	
	ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ServiceTier ChatCompletionNewParamsServiceTier `json:"service_tier,omitzero"`
	
	
	
	
	Stop ChatCompletionNewParamsStopUnion `json:"stop,omitzero"`
	
	StreamOptions ChatCompletionStreamOptionsParam `json:"stream_options,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	FunctionCall ChatCompletionNewParamsFunctionCallUnion `json:"function_call,omitzero"`
	
	
	
	Functions []ChatCompletionNewParamsFunction `json:"functions,omitzero"`
	
	
	Prediction ChatCompletionPredictionContentParam `json:"prediction,omitzero"`
	
	
	
	
	
	
	
	
	
	
	ResponseFormat ChatCompletionNewParamsResponseFormatUnion `json:"response_format,omitzero"`
	
	
	
	
	
	
	
	
	
	ToolChoice ChatCompletionToolChoiceOptionUnionParam `json:"tool_choice,omitzero"`
	
	
	
	Tools []ChatCompletionToolParam `json:"tools,omitzero"`
	
	
	
	WebSearchOptions ChatCompletionNewParamsWebSearchOptions `json:"web_search_options,omitzero"`
	
}

Deprecated: deprecated

The property Name is required.

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.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

type ChatCompletionNewParamsServiceTier string

Specifies the processing type used for serving the request.

When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

type ChatCompletionNewParamsStopUnion struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Approximate location parameters for the search.

The properties Approximate, Type are required.

type ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate struct {
	
	City param.Opt[string] `json:"city,omitzero"`
	
	
	Country param.Opt[string] `json:"country,omitzero"`
	
	Region param.Opt[string] `json:"region,omitzero"`
	
	
	Timezone param.Opt[string] `json:"timezone,omitzero"`
	
}

Approximate location parameters for the search.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Static predicted output content, such as the content of a text file that is being regenerated.

The properties Content, Type are required.

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.

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.

Delete a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` can be deleted.

Get a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` will be returned.

List stored Chat Completions. Only Chat Completions that have been stored with the `store` parameter set to `true` will be returned.

List stored Chat Completions. Only Chat Completions that have been stored with the `store` parameter set to `true` will be returned.

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 string

Specifies the processing type used for serving the request.

When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

A chat completion message generated by the model.

Returns the unmodified JSON received from the API

type ChatCompletionStreamOptionsParam struct {
	
	
	
	
	
	
	
	IncludeUsage param.Opt[bool] `json:"include_usage,omitzero"`
	
}

Options for streaming response. Only set this when you set `stream: true`.

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.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

The properties Content, Role, ToolCallID are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

The properties Function, Type are required.

type ChatCompletionUpdateParams struct {
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero,required"`
	
}

Messages sent by an end user, containing prompts or additional context information.

The properties Content, Role are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

This is an alias to an internal type.

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.

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.

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.

NewClient generates a new client with the default option read from the environment (OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID, OPENAI_WEBHOOK_SECRET, OPENAI_BASE_URL). 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.

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

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:

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

Text output from the Code Interpreter tool call as part of a run step.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.Overrides()

Details of the Code Interpreter tool call the run step was involved in.

Returns the unmodified JSON received from the API

The Code Interpreter tool call definition.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type CodeInterpreterToolCallCodeInterpreterOutputImageImage struct {
	
	
	FileID string `json:"file_id,required"`
	
	JSON struct {
		FileID      respjson.Field
		ExtraFields map[string]respjson.Field
		
	} `json:"-"`
}

Returns the unmodified JSON received from the API

Text output from the Code Interpreter tool call as part of a run step.

Returns the unmodified JSON received from the API

Details of the Code Interpreter tool call the run step was involved in.

Returns the unmodified JSON received from the API

The Code Interpreter tool call definition.

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion.AsAny().(type) {
case openai.CodeInterpreterLogs:
case openai.CodeInterpreterOutputImage:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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.

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.

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.

The value to compare against the attribute key; supports string, number, or boolean types.

This is an alias to an internal type.

The value to compare against the attribute key; supports string, number, or boolean types.

This is an alias to an internal type.

Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.

Returns the unmodified JSON received from the API

type CompletionNewParams struct {
	
	
	
	
	
	
	Prompt CompletionNewParamsPromptUnion `json:"prompt,omitzero,required"`
	
	
	
	
	
	Model CompletionNewParamsModel `json:"model,omitzero,required"`
	
	
	
	
	
	
	
	
	
	BestOf param.Opt[int64] `json:"best_of,omitzero"`
	
	Echo param.Opt[bool] `json:"echo,omitzero"`
	
	
	
	
	
	FrequencyPenalty param.Opt[float64] `json:"frequency_penalty,omitzero"`
	
	
	
	
	
	
	Logprobs param.Opt[int64] `json:"logprobs,omitzero"`
	
	
	
	
	
	
	
	MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"`
	
	
	
	
	
	N param.Opt[int64] `json:"n,omitzero"`
	
	
	
	
	
	PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"`
	
	
	
	
	
	
	Seed param.Opt[int64] `json:"seed,omitzero"`
	
	
	
	Suffix param.Opt[string] `json:"suffix,omitzero"`
	
	
	
	
	
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	
	
	
	
	
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	
	
	
	User param.Opt[string] `json:"user,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	LogitBias map[string]int64 `json:"logit_bias,omitzero"`
	
	
	
	
	Stop CompletionNewParamsStopUnion `json:"stop,omitzero"`
	
	StreamOptions ChatCompletionStreamOptionsParam `json:"stream_options,omitzero"`
	
}
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"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type CompletionNewParamsStopUnion struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

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.

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.

Creates a completion for the provided prompt and parameters.

Creates a completion for the provided prompt and parameters.

Usage statistics for the completion request.

Returns the unmodified JSON received from the API

type CompletionUsageCompletionTokensDetails struct {
	
	
	AcceptedPredictionTokens int64 `json:"accepted_prediction_tokens"`
	
	AudioTokens int64 `json:"audio_tokens"`
	
	ReasoningTokens int64 `json:"reasoning_tokens"`
	
	
	
	
	RejectedPredictionTokens int64 `json:"rejected_prediction_tokens"`
	
	JSON struct {
		AcceptedPredictionTokens respjson.Field
		AudioTokens              respjson.Field
		ReasoningTokens          respjson.Field
		RejectedPredictionTokens respjson.Field
		ExtraFields              map[string]respjson.Field
		
	} `json:"-"`
}

Breakdown of tokens used in a completion.

Returns the unmodified JSON received from the API

Breakdown of tokens used in the prompt.

Returns the unmodified JSON received from the API

Combine multiple filters using `and` or `or`.

This is an alias to an internal type.

Combine multiple filters using `and` or `or`.

This is an alias to an internal type.

Type of operation: `and` or `or`.

This is an alias to an internal type.

ContainerFileContentService 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 NewContainerFileContentService method instead.

NewContainerFileContentService 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.

Retrieve Container File Content

Returns the unmodified JSON received from the API

type ContainerFileListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

Returns the unmodified JSON received from the API

type ContainerFileNewParams struct {
	
	FileID param.Opt[string] `json:"file_id,omitzero"`
	
	File io.Reader `json:"file,omitzero" format:"binary"`
	
}

Returns the unmodified JSON received from the API

ContainerFileService 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 NewContainerFileService method instead.

NewContainerFileService 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.

Create a Container File

You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.

Returns the unmodified JSON received from the API

The container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.

Returns the unmodified JSON received from the API

type ContainerListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

Returns the unmodified JSON received from the API

The container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.

Returns the unmodified JSON received from the API

type ContainerNewParamsExpiresAfter struct {
	
	
	
	
	Anchor  string `json:"anchor,omitzero,required"`
	Minutes int64  `json:"minutes,required"`
	
}

Container expiration time in seconds relative to the 'anchor' time.

The properties Anchor, Minutes are required.

Returns the unmodified JSON received from the API

The container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.

Returns the unmodified JSON received from the API

ContainerService 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 NewContainerService method instead.

NewContainerService 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.

Returns the unmodified JSON received from the API

The usage information for the request.

Returns the unmodified JSON received from the API

The hyperparameters used for the DPO fine-tuning job.

type DpoHyperparametersBatchSizeUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

DpoHyperparametersBatchSizeUnionResp 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]

Returns the unmodified JSON received from the API

type DpoHyperparametersBetaUnion struct {
	
	OfAuto  constant.Auto      `json:",omitzero,inline"`
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

DpoHyperparametersBetaUnionResp 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]

Returns the unmodified JSON received from the API

type DpoHyperparametersLearningRateMultiplierUnion struct {
	
	OfAuto  constant.Auto      `json:",omitzero,inline"`
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

DpoHyperparametersLearningRateMultiplierUnionResp 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]

Returns the unmodified JSON received from the API

type DpoHyperparametersNEpochsUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

DpoHyperparametersNEpochsUnionResp 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]

Returns the unmodified JSON received from the API

The hyperparameters used for the DPO fine-tuning job.

Returns the unmodified JSON received from the API

ToParam converts this DpoHyperparametersResp to a DpoHyperparameters.

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 DpoHyperparameters.Overrides()

Configuration for the DPO fine-tuning method.

Returns the unmodified JSON received from the API

ToParam converts this DpoMethod to a DpoMethodParam.

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 DpoMethodParam.Overrides()

type DpoMethodParam struct {
	
	Hyperparameters DpoHyperparameters `json:"hyperparameters,omitzero"`
	
}

Configuration for the DPO fine-tuning method.

Represents an embedding vector returned by embedding endpoint.

Returns the unmodified JSON received from the API

const (
	EmbeddingModelTextEmbeddingAda002 EmbeddingModel = "text-embedding-ada-002"
	EmbeddingModelTextEmbedding3Small EmbeddingModel = "text-embedding-3-small"
	EmbeddingModelTextEmbedding3Large EmbeddingModel = "text-embedding-3-large"
)
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"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

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.

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.

Creates an embedding vector representing the input text.

This is an alias to an internal type.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

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.

Use the following switch statement to find the correct variant

switch variant := FileChunkingStrategyUnion.AsAny().(type) {
case openai.StaticFileChunkingStrategyObject:
case openai.OtherFileChunkingStrategyObject:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

URLQuery serializes FileListParams's query parameters as `url.Values`.

type FileListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

type FileNewParams struct {
	
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	
	
	
	
	
	
	Purpose FilePurpose `json:"purpose,omitzero,required"`
	
}

The `File` object represents a document that has been uploaded to OpenAI.

Returns the unmodified JSON received from the API

The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.

Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.

A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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

Returns the unmodified JSON received from the API

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.Overrides()

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

For now, this is always going to be an empty object.

Returns the unmodified JSON received from the API

The ranking options for the file search.

Returns the unmodified JSON received from the API

A result instance of the file search.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Overrides for the file search tool.

Returns the unmodified JSON received from the API

Overrides for the file search tool.

The property Type is required.

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.

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.

Returns the contents of the specified file.

Returns information about a specific file.

type FineTuningAlphaGraderRunParamsGraderUnion struct {
	OfStringCheck    *StringCheckGraderParam    `json:",omitzero,inline"`
	OfTextSimilarity *TextSimilarityGraderParam `json:",omitzero,inline"`
	OfPython         *PythonGraderParam         `json:",omitzero,inline"`
	OfScoreModel     *ScoreModelGraderParam     `json:",omitzero,inline"`
	OfMulti          *MultiGraderParam          `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type FineTuningAlphaGraderRunResponseMetadataErrors struct {
	FormulaParseError               bool   `json:"formula_parse_error,required"`
	InvalidVariableError            bool   `json:"invalid_variable_error,required"`
	ModelGraderParseError           bool   `json:"model_grader_parse_error,required"`
	ModelGraderRefusalError         bool   `json:"model_grader_refusal_error,required"`
	ModelGraderServerError          bool   `json:"model_grader_server_error,required"`
	ModelGraderServerErrorDetails   string `json:"model_grader_server_error_details,required"`
	OtherError                      bool   `json:"other_error,required"`
	PythonGraderRuntimeError        bool   `json:"python_grader_runtime_error,required"`
	PythonGraderRuntimeErrorDetails string `json:"python_grader_runtime_error_details,required"`
	PythonGraderServerError         bool   `json:"python_grader_server_error,required"`
	PythonGraderServerErrorType     string `json:"python_grader_server_error_type,required"`
	SampleParseError                bool   `json:"sample_parse_error,required"`
	TruncatedObservationError       bool   `json:"truncated_observation_error,required"`
	UnresponsiveRewardError         bool   `json:"unresponsive_reward_error,required"`
	
	JSON struct {
		FormulaParseError               respjson.Field
		InvalidVariableError            respjson.Field
		ModelGraderParseError           respjson.Field
		ModelGraderRefusalError         respjson.Field
		ModelGraderServerError          respjson.Field
		ModelGraderServerErrorDetails   respjson.Field
		OtherError                      respjson.Field
		PythonGraderRuntimeError        respjson.Field
		PythonGraderRuntimeErrorDetails respjson.Field
		PythonGraderServerError         respjson.Field
		PythonGraderServerErrorType     respjson.Field
		SampleParseError                respjson.Field
		TruncatedObservationError       respjson.Field
		UnresponsiveRewardError         respjson.Field
		ExtraFields                     map[string]respjson.Field
		
	} `json:"-"`
}

Returns the unmodified JSON received from the API

FineTuningAlphaGraderService 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 NewFineTuningAlphaGraderService method instead.

NewFineTuningAlphaGraderService 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 FineTuningAlphaGraderValidateParamsGraderUnion struct {
	OfStringCheckGrader    *StringCheckGraderParam    `json:",omitzero,inline"`
	OfTextSimilarityGrader *TextSimilarityGraderParam `json:",omitzero,inline"`
	OfPythonGrader         *PythonGraderParam         `json:",omitzero,inline"`
	OfScoreModelGrader     *ScoreModelGraderParam     `json:",omitzero,inline"`
	OfMultiGrader          *MultiGraderParam          `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns the unmodified JSON received from the API

type FineTuningAlphaGraderValidateResponseGraderUnionInput struct {
	
	OfString string `json:",inline"`
	
	
	OfScoreModelGraderInputArray []ScoreModelGraderInput `json:",inline"`
	JSON                         struct {
		OfString                     respjson.Field
		OfScoreModelGraderInputArray respjson.Field
		
	} `json:"-"`
}

FineTuningAlphaGraderValidateResponseGraderUnionInput is an implicit subunion of FineTuningAlphaGraderValidateResponseGraderUnion. FineTuningAlphaGraderValidateResponseGraderUnionInput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the FineTuningAlphaGraderValidateResponseGraderUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfScoreModelGraderInputArray]

FineTuningAlphaService 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 NewFineTuningAlphaService method instead.

NewFineTuningAlphaService 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.

Returns the unmodified JSON received from the API

type FineTuningCheckpointPermissionGetParamsOrder string

The order in which to retrieve permissions.

Returns the unmodified JSON received from the API

The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.

Returns the unmodified JSON received from the API

type FineTuningCheckpointPermissionNewParams struct {
	
	ProjectIDs []string `json:"project_ids,omitzero,required"`
	
}

The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.

Returns the unmodified JSON received from the API

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.

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.

**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.

**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.

**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.

**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.

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.

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 struct {
	
	ID string `json:"id,required"`
	
	CreatedAt int64 `json:"created_at,required"`
	
	
	Error FineTuningJobError `json:"error,required"`
	
	
	FineTunedModel string `json:"fine_tuned_model,required"`
	
	
	FinishedAt int64 `json:"finished_at,required"`
	
	
	Hyperparameters FineTuningJobHyperparameters `json:"hyperparameters,required"`
	
	Model string `json:"model,required"`
	
	Object constant.FineTuningJob `json:"object,required"`
	
	OrganizationID string `json:"organization_id,required"`
	
	
	
	ResultFiles []string `json:"result_files,required"`
	
	Seed int64 `json:"seed,required"`
	
	
	
	
	
	Status FineTuningJobStatus `json:"status,required"`
	
	
	TrainedTokens int64 `json:"trained_tokens,required"`
	
	
	TrainingFile string `json:"training_file,required"`
	
	
	
	ValidationFile string `json:"validation_file,required"`
	
	
	EstimatedFinish int64 `json:"estimated_finish,nullable"`
	
	Integrations []FineTuningJobWandbIntegrationObject `json:"integrations,nullable"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,nullable"`
	
	Method FineTuningJobMethod `json:"method"`
	
	JSON struct {
		ID              respjson.Field
		CreatedAt       respjson.Field
		Error           respjson.Field
		FineTunedModel  respjson.Field
		FinishedAt      respjson.Field
		Hyperparameters respjson.Field
		Model           respjson.Field
		Object          respjson.Field
		OrganizationID  respjson.Field
		ResultFiles     respjson.Field
		Seed            respjson.Field
		Status          respjson.Field
		TrainedTokens   respjson.Field
		TrainingFile    respjson.Field
		ValidationFile  respjson.Field
		EstimatedFinish respjson.Field
		Integrations    respjson.Field
		Metadata        respjson.Field
		Method          respjson.Field
		ExtraFields     map[string]respjson.Field
		
	} `json:"-"`
}

The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.

Returns the unmodified JSON received from the API

The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.

Returns the unmodified JSON received from the API

type FineTuningJobCheckpointListParams struct {
	
	After param.Opt[string] `query:"after,omitzero" json:"-"`
	
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	
}

Metrics at the step number during the fine-tuning job.

Returns the unmodified JSON received from the API

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.

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.

List checkpoints for a fine-tuning job.

List checkpoints for a fine-tuning job.

For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.

Returns the unmodified JSON received from the API

Fine-tuning job event object

Returns the unmodified JSON received from the API

type FineTuningJobEventLevel string

The log level of the event.

type FineTuningJobEventType string

The type of event.

The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

type FineTuningJobListEventsParams struct {
	
	After param.Opt[string] `query:"after,omitzero" json:"-"`
	
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	
}
type FineTuningJobListParams struct {
	
	After param.Opt[string] `query:"after,omitzero" json:"-"`
	
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	
	
	Metadata map[string]string `query:"metadata,omitzero" json:"-"`
	
}

The method used for fine-tuning.

Returns the unmodified JSON received from the API

type FineTuningJobNewParams struct {
	
	
	Model FineTuningJobNewParamsModel `json:"model,omitzero,required"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	TrainingFile string `json:"training_file,required"`
	
	
	
	Seed param.Opt[int64] `json:"seed,omitzero"`
	
	
	
	
	
	Suffix param.Opt[string] `json:"suffix,omitzero"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	ValidationFile param.Opt[string] `json:"validation_file,omitzero"`
	
	Integrations []FineTuningJobNewParamsIntegration `json:"integrations,omitzero"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,omitzero"`
	
	
	Hyperparameters FineTuningJobNewParamsHyperparameters `json:"hyperparameters,omitzero"`
	
	Method FineTuningJobNewParamsMethod `json:"method,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.

Deprecated: deprecated

type FineTuningJobNewParamsHyperparametersBatchSizeUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion struct {
	
	OfAuto  constant.Auto      `json:",omitzero,inline"`
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type FineTuningJobNewParamsHyperparametersNEpochsUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

The properties Type, Wandb are required.

type FineTuningJobNewParamsIntegrationWandb
type FineTuningJobNewParamsIntegrationWandb struct {
	
	Project string `json:"project,required"`
	
	
	
	Entity param.Opt[string] `json:"entity,omitzero"`
	
	
	Name param.Opt[string] `json:"name,omitzero"`
	
	
	
	Tags []string `json:"tags,omitzero"`
	
}

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.

The method used for fine-tuning.

The property Type is required.

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.

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.

Immediately cancel a fine-tune job.

List your organization's fine-tuning jobs

List your organization's fine-tuning jobs

Get status updates for a fine-tuning job.

Get status updates for a fine-tuning job.

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/model-optimization)

type FineTuningJobStatus string

The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.

type FineTuningJobWandbIntegration

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

Returns the unmodified JSON received from the API

FineTuningMethodService 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 NewFineTuningMethodService method instead.

NewFineTuningMethodService 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.

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.

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.

This is an alias to an internal type.

This is an alias to an internal type.

Returns the unmodified JSON received from the API

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.Overrides()

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

The definition of the function that was called.

Returns the unmodified JSON received from the API

The definition of the function that was called.

Returns the unmodified JSON received from the API

The properties Function, Type are required.

GraderGraderModelService 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 NewGraderGraderModelService method instead.

NewGraderGraderModelService 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.

GraderService 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 NewGraderService method instead.

NewGraderService 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.

Represents the content or the URL of an image generated by the OpenAI API.

Returns the unmodified JSON received from the API

Emitted when image editing has completed and the final image is available.

Returns the unmodified JSON received from the API

type ImageEditCompletedEventBackground string

The background setting for the edited image.

type ImageEditCompletedEventOutputFormat string

The output format for the edited image.

type ImageEditCompletedEventQuality string

The quality setting for the edited image.

type ImageEditCompletedEventSize string

The size of the edited image.

For `gpt-image-1` only, the token usage information for the image generation.

Returns the unmodified JSON received from the API

type ImageEditCompletedEventUsageInputTokensDetails struct {
	
	ImageTokens int64 `json:"image_tokens,required"`
	
	TextTokens int64 `json:"text_tokens,required"`
	
	JSON struct {
		ImageTokens respjson.Field
		TextTokens  respjson.Field
		ExtraFields map[string]respjson.Field
		
	} `json:"-"`
}

The input tokens detailed information for the image generation.

Returns the unmodified JSON received from the API

type ImageEditParams struct {
	
	
	
	
	
	
	
	Image ImageEditParamsImageUnion `json:"image,omitzero,required" format:"binary"`
	
	
	Prompt string `json:"prompt,required"`
	
	N param.Opt[int64] `json:"n,omitzero"`
	
	
	
	OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
	
	
	
	
	
	
	PartialImages param.Opt[int64] `json:"partial_images,omitzero"`
	
	
	
	User param.Opt[string] `json:"user,omitzero"`
	
	
	
	
	
	
	
	
	
	Background ImageEditParamsBackground `json:"background,omitzero"`
	
	
	
	
	
	InputFidelity ImageEditParamsInputFidelity `json:"input_fidelity,omitzero"`
	
	
	
	Model ImageModel `json:"model,omitzero"`
	
	
	
	
	
	OutputFormat ImageEditParamsOutputFormat `json:"output_format,omitzero"`
	
	
	
	
	
	Quality ImageEditParamsQuality `json:"quality,omitzero"`
	
	
	
	
	
	
	ResponseFormat ImageEditParamsResponseFormat `json:"response_format,omitzero"`
	
	
	
	
	
	Size ImageEditParamsSize `json:"size,omitzero"`
	
	
	
	
	Mask io.Reader `json:"mask,omitzero" format:"binary"`
	
}
type ImageEditParamsBackground string

Allows to set transparency for the background of the generated image(s). This parameter is only supported for `gpt-image-1`. Must be one of `transparent`, `opaque` or `auto` (default value). When `auto` is used, the model will automatically determine the best background for the image.

If `transparent`, the output format needs to support transparency, so it should be set to either `png` (default value) or `webp`.

type ImageEditParamsImageUnion struct {
	OfFile      io.Reader   `json:",omitzero,inline"`
	OfFileArray []io.Reader `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type ImageEditParamsInputFidelity string

Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.

type ImageEditParamsOutputFormat string

The format in which the generated images are returned. This parameter is only supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The default value is `png`.

type ImageEditParamsQuality string

The quality of the image that will be generated. `high`, `medium` and `low` are only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality. Defaults to `auto`.

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. This parameter is only supported for `dall-e-2`, as `gpt-image-1` will always return base64-encoded images.

type ImageEditParamsSize string

The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.

Emitted when a partial image is available during image editing streaming.

Returns the unmodified JSON received from the API

type ImageEditPartialImageEventBackground string

The background setting for the requested edited image.

type ImageEditPartialImageEventOutputFormat string

The output format for the requested edited image.

type ImageEditPartialImageEventQuality string

The quality setting for the requested edited image.

type ImageEditPartialImageEventSize string

The size of the requested edited image.

ImageEditStreamEventUnion contains all possible properties and values from ImageEditPartialImageEvent, ImageEditCompletedEvent.

Use the ImageEditStreamEventUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

Use the following switch statement to find the correct variant

switch variant := ImageEditStreamEventUnion.AsAny().(type) {
case openai.ImageEditPartialImageEvent:
case openai.ImageEditCompletedEvent:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.Overrides()

References an image File(https://platform.openai.com/docs/api-reference/files) in the content of a message.

Returns the unmodified JSON received from the API

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.Overrides()

Returns the unmodified JSON received from the API

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`.

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`.

type ImageFileParam struct {
	
	
	
	FileID string `json:"file_id,required"`
	
	
	
	
	Detail ImageFileDetail `json:"detail,omitzero"`
	
}

The property FileID is required.

Emitted when image generation has completed and the final image is available.

Returns the unmodified JSON received from the API

type ImageGenCompletedEventBackground string

The background setting for the generated image.

type ImageGenCompletedEventOutputFormat string

The output format for the generated image.

type ImageGenCompletedEventQuality string

The quality setting for the generated image.

type ImageGenCompletedEventSize string

The size of the generated image.

For `gpt-image-1` only, the token usage information for the image generation.

Returns the unmodified JSON received from the API

type ImageGenCompletedEventUsageInputTokensDetails struct {
	
	ImageTokens int64 `json:"image_tokens,required"`
	
	TextTokens int64 `json:"text_tokens,required"`
	
	JSON struct {
		ImageTokens respjson.Field
		TextTokens  respjson.Field
		ExtraFields map[string]respjson.Field
		
	} `json:"-"`
}

The input tokens detailed information for the image generation.

Returns the unmodified JSON received from the API

Emitted when a partial image is available during image generation streaming.

Returns the unmodified JSON received from the API

type ImageGenPartialImageEventBackground string

The background setting for the requested image.

type ImageGenPartialImageEventOutputFormat string

The output format for the requested image.

type ImageGenPartialImageEventQuality string

The quality setting for the requested image.

type ImageGenPartialImageEventSize string

The size of the requested image.

ImageGenStreamEventUnion contains all possible properties and values from ImageGenPartialImageEvent, ImageGenCompletedEvent.

Use the ImageGenStreamEventUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

Use the following switch statement to find the correct variant

switch variant := ImageGenStreamEventUnion.AsAny().(type) {
case openai.ImageGenPartialImageEvent:
case openai.ImageGenCompletedEvent:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

type ImageGenerateParams struct {
	
	
	
	Prompt string `json:"prompt,required"`
	
	
	N param.Opt[int64] `json:"n,omitzero"`
	
	
	
	OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
	
	
	
	
	
	
	PartialImages param.Opt[int64] `json:"partial_images,omitzero"`
	
	
	
	User param.Opt[string] `json:"user,omitzero"`
	
	
	
	
	
	
	
	
	
	Background ImageGenerateParamsBackground `json:"background,omitzero"`
	
	
	
	Model ImageModel `json:"model,omitzero"`
	
	
	
	
	Moderation ImageGenerateParamsModeration `json:"moderation,omitzero"`
	
	
	
	
	OutputFormat ImageGenerateParamsOutputFormat `json:"output_format,omitzero"`
	
	
	
	
	
	
	
	
	
	Quality ImageGenerateParamsQuality `json:"quality,omitzero"`
	
	
	
	
	
	
	ResponseFormat ImageGenerateParamsResponseFormat `json:"response_format,omitzero"`
	
	
	
	
	
	
	
	Size ImageGenerateParamsSize `json:"size,omitzero"`
	
	
	
	
	
	
	Style ImageGenerateParamsStyle `json:"style,omitzero"`
	
}
type ImageGenerateParamsBackground string

Allows to set transparency for the background of the generated image(s). This parameter is only supported for `gpt-image-1`. Must be one of `transparent`, `opaque` or `auto` (default value). When `auto` is used, the model will automatically determine the best background for the image.

If `transparent`, the output format needs to support transparency, so it should be set to either `png` (default value) or `webp`.

type ImageGenerateParamsModeration string

Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` for less restrictive filtering or `auto` (default value).

type ImageGenerateParamsOutputFormat string

The format in which the generated images are returned. This parameter is only supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`.

type ImageGenerateParamsQuality string

The quality of the image that will be generated.

type ImageGenerateParamsResponseFormat string

The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images.

type ImageGenerateParamsSize string

The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.

type ImageGenerateParamsStyle string

The style of the generated images. This parameter is only supported for `dall-e-3`. 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.

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.

type ImageNewVariationParamsSize string

The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.

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.

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.

Creates an edited or extended image given one or more source images and a prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`.

Creates an edited or extended image given one or more source images and a prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`.

Creates a variation of a given image. This endpoint only supports `dall-e-2`.

Returns the unmodified JSON received from the API

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.Overrides()

References an image URL in the content of a message.

Returns the unmodified JSON received from the API

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.Overrides()

type ImageURLContentBlockParam struct {
	ImageURL ImageURLParam `json:"image_url,omitzero,required"`
	
	
	
	Type constant.ImageURL `json:"type,required"`
	
}

References an image URL in the content of a message.

The properties ImageURL, Type are required.

Returns the unmodified JSON received from the API

References an image URL in the content of a message.

Returns the unmodified JSON received from the API

type ImageURLDeltaDetail string

Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`.

Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`

type ImageURLParam struct {
	
	
	URL string `json:"url,required" format:"uri"`
	
	
	
	
	Detail ImageURLDetail `json:"detail,omitzero"`
	
}

The property URL is required.

The response from the image generation endpoint.

Returns the unmodified JSON received from the API

type ImagesResponseBackground string

The background parameter used for the image generation. Either `transparent` or `opaque`.

type ImagesResponseOutputFormat string

The output format of the image generation. Either `png`, `webp`, or `jpeg`.

type ImagesResponseQuality string

The quality of the image generated. Either `low`, `medium`, or `high`.

type ImagesResponseSize string

The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`.

For `gpt-image-1` only, the token usage information for the image generation.

Returns the unmodified JSON received from the API

The input tokens detailed information for the image generation.

Returns the unmodified JSON received from the API

A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.

Returns the unmodified JSON received from the API

ToParam converts this LabelModelGrader to a LabelModelGraderParam.

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 LabelModelGraderParam.Overrides()

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

Returns the unmodified JSON received from the API

An image input to the model.

Returns the unmodified JSON received from the API

type LabelModelGraderInputContentInputImageParam struct {
	
	ImageURL string `json:"image_url,required"`
	
	
	Detail param.Opt[string] `json:"detail,omitzero"`
	
	
	
	Type constant.InputImage `json:"type,required"`
	
}

An image input to the model.

The properties ImageURL, Type are required.

A text output from the model.

Returns the unmodified JSON received from the API

type LabelModelGraderInputContentOutputTextParam struct {
	
	Text string `json:"text,required"`
	
	
	
	Type constant.OutputText `json:"type,required"`
	
}

A text output from the model.

The properties Text, Type are required.

type LabelModelGraderInputContentUnionParam struct {
	OfString                          param.Opt[string]                            `json:",omitzero,inline"`
	OfInputText                       *responses.ResponseInputTextParam            `json:",omitzero,inline"`
	OfOutputText                      *LabelModelGraderInputContentOutputTextParam `json:",omitzero,inline"`
	OfInputImage                      *LabelModelGraderInputContentInputImageParam `json:",omitzero,inline"`
	OfAnArrayOfInputTextAndInputImage []any                                        `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

The properties Content, Role are required.

type LabelModelGraderParam struct {
	Input []LabelModelGraderInputParam `json:"input,omitzero,required"`
	
	Labels []string `json:"labels,omitzero,required"`
	
	Model string `json:"model,required"`
	
	Name string `json:"name,required"`
	
	PassingLabels []string `json:"passing_labels,omitzero,required"`
	
	
	
	Type constant.LabelModel `json:"type,required"`
	
}

A LabelModelGrader object which uses a model to assign labels to each item in the evaluation.

The properties Input, Labels, Model, Name, PassingLabels, Type are required.

type Message struct {
	
	ID string `json:"id,required"`
	
	
	
	AssistantID string `json:"assistant_id,required"`
	
	Attachments []MessageAttachment `json:"attachments,required"`
	
	CompletedAt int64 `json:"completed_at,required"`
	
	Content []MessageContentUnion `json:"content,required"`
	
	CreatedAt int64 `json:"created_at,required"`
	
	IncompleteAt int64 `json:"incomplete_at,required"`
	
	IncompleteDetails MessageIncompleteDetails `json:"incomplete_details,required"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,required"`
	
	Object constant.ThreadMessage `json:"object,required"`
	
	
	
	Role MessageRole `json:"role,required"`
	
	
	
	RunID string `json:"run_id,required"`
	
	
	
	
	Status MessageStatus `json:"status,required"`
	
	
	ThreadID string `json:"thread_id,required"`
	
	JSON struct {
		ID                respjson.Field
		AssistantID       respjson.Field
		Attachments       respjson.Field
		CompletedAt       respjson.Field
		Content           respjson.Field
		CreatedAt         respjson.Field
		IncompleteAt      respjson.Field
		IncompleteDetails respjson.Field
		Metadata          respjson.Field
		Object            respjson.Field
		Role              respjson.Field
		RunID             respjson.Field
		Status            respjson.Field
		ThreadID          respjson.Field
		ExtraFields       map[string]respjson.Field
		
	} `json:"-"`
}

Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads).

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type MessageAttachmentToolUnion struct {
	Type string `json:"type"`
	JSON struct {
		Type respjson.Field
		
	} `json:"-"`
}

MessageAttachmentToolUnion contains all possible properties and values from CodeInterpreterTool, MessageAttachmentToolFileSearchTool.

Use the methods beginning with 'As' to cast the union to one of its variants.

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := MessageContentDeltaUnion.AsAny().(type) {
case openai.ImageFileDeltaBlock:
case openai.TextDeltaBlock:
case openai.RefusalDeltaBlock:
case openai.ImageURLDeltaBlock:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

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.

Use the following switch statement to find the correct variant

switch variant := MessageContentUnion.AsAny().(type) {
case openai.ImageFileContentBlock:
case openai.ImageURLContentBlock:
case openai.TextContentBlock:
case openai.RefusalContentBlock:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

Details of the message creation by the run step.

Returns the unmodified JSON received from the API

type MessageCreationStepDetailsMessageCreation struct {
	
	MessageID string `json:"message_id,required"`
	
	JSON struct {
		MessageID   respjson.Field
		ExtraFields map[string]respjson.Field
		
	} `json:"-"`
}

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

The delta containing the fields that have changed on the Message.

Returns the unmodified JSON received from the API

Represents a message delta i.e. any changed fields on a message during streaming.

Returns the unmodified JSON received from the API

The entity that produced the message. One of `user` or `assistant`.

On an incomplete message, details about why the message is incomplete.

Returns the unmodified JSON received from the API

The entity that produced the message. One of `user` or `assistant`.

The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.

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.

Describes an OpenAI model offering that can be used with the API.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.

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.

Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.

Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Returns the unmodified JSON received from the API

type ModerationCategories struct {
	
	
	Harassment bool `json:"harassment,required"`
	
	
	HarassmentThreatening bool `json:"harassment/threatening,required"`
	
	
	
	
	Hate bool `json:"hate,required"`
	
	
	
	HateThreatening bool `json:"hate/threatening,required"`
	
	
	
	Illicit bool `json:"illicit,required"`
	
	
	
	IllicitViolent bool `json:"illicit/violent,required"`
	
	
	SelfHarm bool `json:"self-harm,required"`
	
	
	
	SelfHarmInstructions bool `json:"self-harm/instructions,required"`
	
	
	SelfHarmIntent bool `json:"self-harm/intent,required"`
	
	
	
	Sexual bool `json:"sexual,required"`
	
	SexualMinors bool `json:"sexual/minors,required"`
	
	Violence bool `json:"violence,required"`
	
	ViolenceGraphic bool `json:"violence/graphic,required"`
	
	JSON struct {
		Harassment            respjson.Field
		HarassmentThreatening respjson.Field
		Hate                  respjson.Field
		HateThreatening       respjson.Field
		Illicit               respjson.Field
		IllicitViolent        respjson.Field
		SelfHarm              respjson.Field
		SelfHarmInstructions  respjson.Field
		SelfHarmIntent        respjson.Field
		Sexual                respjson.Field
		SexualMinors          respjson.Field
		Violence              respjson.Field
		ViolenceGraphic       respjson.Field
		ExtraFields           map[string]respjson.Field
		
	} `json:"-"`
}

A list of the categories, and whether they are flagged or not.

Returns the unmodified JSON received from the API

type ModerationCategoryAppliedInputTypes struct {
	
	
	
	Harassment []string `json:"harassment,required"`
	
	
	
	HarassmentThreatening []string `json:"harassment/threatening,required"`
	
	
	
	Hate []string `json:"hate,required"`
	
	
	
	HateThreatening []string `json:"hate/threatening,required"`
	
	
	
	Illicit []string `json:"illicit,required"`
	
	
	
	IllicitViolent []string `json:"illicit/violent,required"`
	
	
	
	SelfHarm []string `json:"self-harm,required"`
	
	
	
	SelfHarmInstructions []string `json:"self-harm/instructions,required"`
	
	
	
	SelfHarmIntent []string `json:"self-harm/intent,required"`
	
	
	
	Sexual []string `json:"sexual,required"`
	
	
	
	SexualMinors []string `json:"sexual/minors,required"`
	
	
	
	Violence []string `json:"violence,required"`
	
	
	
	ViolenceGraphic []string `json:"violence/graphic,required"`
	
	JSON struct {
		Harassment            respjson.Field
		HarassmentThreatening respjson.Field
		Hate                  respjson.Field
		HateThreatening       respjson.Field
		Illicit               respjson.Field
		IllicitViolent        respjson.Field
		SelfHarm              respjson.Field
		SelfHarmInstructions  respjson.Field
		SelfHarmIntent        respjson.Field
		Sexual                respjson.Field
		SexualMinors          respjson.Field
		Violence              respjson.Field
		ViolenceGraphic       respjson.Field
		ExtraFields           map[string]respjson.Field
		
	} `json:"-"`
}

A list of the categories along with the input type(s) that the score applies to.

Returns the unmodified JSON received from the API

type ModerationCategoryScores struct {
	
	Harassment float64 `json:"harassment,required"`
	
	HarassmentThreatening float64 `json:"harassment/threatening,required"`
	
	Hate float64 `json:"hate,required"`
	
	HateThreatening float64 `json:"hate/threatening,required"`
	
	Illicit float64 `json:"illicit,required"`
	
	IllicitViolent float64 `json:"illicit/violent,required"`
	
	SelfHarm float64 `json:"self-harm,required"`
	
	SelfHarmInstructions float64 `json:"self-harm/instructions,required"`
	
	SelfHarmIntent float64 `json:"self-harm/intent,required"`
	
	Sexual float64 `json:"sexual,required"`
	
	SexualMinors float64 `json:"sexual/minors,required"`
	
	Violence float64 `json:"violence,required"`
	
	ViolenceGraphic float64 `json:"violence/graphic,required"`
	
	JSON struct {
		Harassment            respjson.Field
		HarassmentThreatening respjson.Field
		Hate                  respjson.Field
		HateThreatening       respjson.Field
		Illicit               respjson.Field
		IllicitViolent        respjson.Field
		SelfHarm              respjson.Field
		SelfHarmInstructions  respjson.Field
		SelfHarmIntent        respjson.Field
		Sexual                respjson.Field
		SexualMinors          respjson.Field
		Violence              respjson.Field
		ViolenceGraphic       respjson.Field
		ExtraFields           map[string]respjson.Field
		
	} `json:"-"`
}

A list of the categories along with their scores as predicted by model.

Returns the unmodified JSON received from the API

type ModerationImageURLInputImageURLParam struct {
	
	URL string `json:"url,required" format:"uri"`
	
}

Contains either an image URL or a data URL for a base64 encoded image.

The property URL is required.

An object describing an image to classify.

The properties ImageURL, Type are required.

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"
)

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Represents if a given text input is potentially harmful.

Returns the unmodified JSON received from the API

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.

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.

type ModerationTextInputParam struct {
	
	Text string `json:"text,required"`
	
	
	
	Type constant.Text `json:"type,required"`
	
}

An object describing text to classify.

The properties Text, Type are required.

A MultiGrader object combines the output of multiple graders to produce a single score.

Returns the unmodified JSON received from the API

ToParam converts this MultiGrader to a MultiGraderParam.

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 MultiGraderParam.Overrides()

MultiGraderGradersUnionInput is an implicit subunion of MultiGraderGradersUnion. MultiGraderGradersUnionInput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the MultiGraderGradersUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfScoreModelGraderInputArray OfLabelModelGraderInputArray]

type MultiGraderGradersUnionParam struct {
	OfStringCheckGrader    *StringCheckGraderParam    `json:",omitzero,inline"`
	OfTextSimilarityGrader *TextSimilarityGraderParam `json:",omitzero,inline"`
	OfPythonGrader         *PythonGraderParam         `json:",omitzero,inline"`
	OfScoreModelGrader     *ScoreModelGraderParam     `json:",omitzero,inline"`
	OfLabelModelGrader     *LabelModelGraderParam     `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

A MultiGrader object combines the output of multiple graders to produce a single score.

The properties CalculateOutput, Graders, Name, Type are required.

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.

Returns the unmodified JSON received from the API

A PythonGrader object that runs a python script on the input.

Returns the unmodified JSON received from the API

ToParam converts this PythonGrader to a PythonGraderParam.

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 PythonGraderParam.Overrides()

type PythonGraderParam struct {
	
	Name string `json:"name,required"`
	
	Source string `json:"source,required"`
	
	ImageTag param.Opt[string] `json:"image_tag,omitzero"`
	
	
	
	Type constant.Python `json:"type,required"`
	
}

A PythonGrader object that runs a python script on the input.

The properties Name, Source, Type are required.

**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.

**Deprecated:** use `summary` instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.

This is an alias to an internal type.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.

This is an alias to an internal type.

The refusal content generated by the assistant.

Returns the unmodified JSON received from the API

The refusal content that is part of a message.

Returns the unmodified JSON received from the API

The hyperparameters used for the reinforcement fine-tuning job.

type ReinforcementHyperparametersBatchSizeUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

ReinforcementHyperparametersBatchSizeUnionResp 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]

Returns the unmodified JSON received from the API

type ReinforcementHyperparametersComputeMultiplierUnion struct {
	
	OfAuto  constant.Auto      `json:",omitzero,inline"`
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

ReinforcementHyperparametersComputeMultiplierUnionResp 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]

Returns the unmodified JSON received from the API

type ReinforcementHyperparametersEvalIntervalUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

ReinforcementHyperparametersEvalIntervalUnionResp 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]

Returns the unmodified JSON received from the API

type ReinforcementHyperparametersEvalSamplesUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

ReinforcementHyperparametersEvalSamplesUnionResp 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]

Returns the unmodified JSON received from the API

type ReinforcementHyperparametersLearningRateMultiplierUnion struct {
	
	OfAuto  constant.Auto      `json:",omitzero,inline"`
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

ReinforcementHyperparametersLearningRateMultiplierUnionResp 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]

Returns the unmodified JSON received from the API

type ReinforcementHyperparametersNEpochsUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

ReinforcementHyperparametersNEpochsUnionResp 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]

Returns the unmodified JSON received from the API

type ReinforcementHyperparametersReasoningEffort string

Level of reasoning effort.

The hyperparameters used for the reinforcement fine-tuning job.

Returns the unmodified JSON received from the API

ToParam converts this ReinforcementHyperparametersResp to a ReinforcementHyperparameters.

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 ReinforcementHyperparameters.Overrides()

Configuration for the reinforcement fine-tuning method.

Returns the unmodified JSON received from the API

ToParam converts this ReinforcementMethod to a ReinforcementMethodParam.

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 ReinforcementMethodParam.Overrides()

ReinforcementMethodGraderUnionInput is an implicit subunion of ReinforcementMethodGraderUnion. ReinforcementMethodGraderUnionInput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ReinforcementMethodGraderUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfScoreModelGraderInputArray]

type ReinforcementMethodGraderUnionParam struct {
	OfStringCheckGrader    *StringCheckGraderParam    `json:",omitzero,inline"`
	OfTextSimilarityGrader *TextSimilarityGraderParam `json:",omitzero,inline"`
	OfPythonGrader         *PythonGraderParam         `json:",omitzero,inline"`
	OfScoreModelGrader     *ScoreModelGraderParam     `json:",omitzero,inline"`
	OfMultiGrader          *MultiGraderParam          `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Configuration for the reinforcement fine-tuning method.

The property Grader is required.

Tool call objects

Returns the unmodified JSON received from the API

The function definition.

Returns the unmodified JSON received from the API

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.

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.

Structured Outputs configuration options, including a JSON Schema.

This is an alias to an internal type.

Structured Outputs configuration options, including a JSON Schema.

This is an alias to an internal type.

Default response format. Used to generate text responses.

This is an alias to an internal type.

Default response format. Used to generate text responses.

This is an alias to an internal type.

This is an alias to an internal type.

type Run struct {
	
	ID string `json:"id,required"`
	
	
	
	AssistantID string `json:"assistant_id,required"`
	
	CancelledAt int64 `json:"cancelled_at,required"`
	
	CompletedAt int64 `json:"completed_at,required"`
	
	CreatedAt int64 `json:"created_at,required"`
	
	ExpiresAt int64 `json:"expires_at,required"`
	
	FailedAt int64 `json:"failed_at,required"`
	
	
	IncompleteDetails RunIncompleteDetails `json:"incomplete_details,required"`
	
	
	
	Instructions string `json:"instructions,required"`
	
	LastError RunLastError `json:"last_error,required"`
	
	
	MaxCompletionTokens int64 `json:"max_completion_tokens,required"`
	
	
	MaxPromptTokens int64 `json:"max_prompt_tokens,required"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,required"`
	
	
	
	Model string `json:"model,required"`
	
	Object constant.ThreadRun `json:"object,required"`
	
	
	
	ParallelToolCalls bool `json:"parallel_tool_calls,required"`
	
	
	RequiredAction RunRequiredAction `json:"required_action,required"`
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	ResponseFormat AssistantResponseFormatOptionUnion `json:"response_format,required"`
	
	StartedAt int64 `json:"started_at,required"`
	
	
	
	
	
	
	Status RunStatus `json:"status,required"`
	
	
	ThreadID string `json:"thread_id,required"`
	
	
	
	
	
	
	
	ToolChoice AssistantToolChoiceOptionUnion `json:"tool_choice,required"`
	
	
	
	Tools []AssistantToolUnion `json:"tools,required"`
	
	
	TruncationStrategy RunTruncationStrategy `json:"truncation_strategy,required"`
	
	
	Usage RunUsage `json:"usage,required"`
	
	Temperature float64 `json:"temperature,nullable"`
	
	TopP float64 `json:"top_p,nullable"`
	
	JSON struct {
		ID                  respjson.Field
		AssistantID         respjson.Field
		CancelledAt         respjson.Field
		CompletedAt         respjson.Field
		CreatedAt           respjson.Field
		ExpiresAt           respjson.Field
		FailedAt            respjson.Field
		IncompleteDetails   respjson.Field
		Instructions        respjson.Field
		LastError           respjson.Field
		MaxCompletionTokens respjson.Field
		MaxPromptTokens     respjson.Field
		Metadata            respjson.Field
		Model               respjson.Field
		Object              respjson.Field
		ParallelToolCalls   respjson.Field
		RequiredAction      respjson.Field
		ResponseFormat      respjson.Field
		StartedAt           respjson.Field
		Status              respjson.Field
		ThreadID            respjson.Field
		ToolChoice          respjson.Field
		Tools               respjson.Field
		TruncationStrategy  respjson.Field
		Usage               respjson.Field
		Temperature         respjson.Field
		TopP                respjson.Field
		ExtraFields         map[string]respjson.Field
		
	} `json:"-"`
}

Represents an execution run on a [thread](https://platform.openai.com/docs/api-reference/threads).

Returns the unmodified JSON received from the API

Details on why the run is incomplete. Will be `null` if the run is not incomplete.

Returns the unmodified JSON received from the API

The last error associated with this run. Will be `null` if there are no errors.

Returns the unmodified JSON received from the API

Details on the action required to continue the run. Will be `null` if no action is required.

Returns the unmodified JSON received from the API

Details on the tool outputs needed for this run to continue.

Returns the unmodified JSON received from the API

The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.

type RunStep struct {
	
	ID string `json:"id,required"`
	
	
	
	AssistantID string `json:"assistant_id,required"`
	
	CancelledAt int64 `json:"cancelled_at,required"`
	
	CompletedAt int64 `json:"completed_at,required"`
	
	CreatedAt int64 `json:"created_at,required"`
	
	
	ExpiredAt int64 `json:"expired_at,required"`
	
	FailedAt int64 `json:"failed_at,required"`
	
	
	LastError RunStepLastError `json:"last_error,required"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,required"`
	
	Object constant.ThreadRunStep `json:"object,required"`
	
	
	RunID string `json:"run_id,required"`
	
	
	
	
	Status RunStepStatus `json:"status,required"`
	
	StepDetails RunStepStepDetailsUnion `json:"step_details,required"`
	
	
	ThreadID string `json:"thread_id,required"`
	
	
	
	Type RunStepType `json:"type,required"`
	
	
	Usage RunStepUsage `json:"usage,required"`
	
	JSON struct {
		ID          respjson.Field
		AssistantID respjson.Field
		CancelledAt respjson.Field
		CompletedAt respjson.Field
		CreatedAt   respjson.Field
		ExpiredAt   respjson.Field
		FailedAt    respjson.Field
		LastError   respjson.Field
		Metadata    respjson.Field
		Object      respjson.Field
		RunID       respjson.Field
		Status      respjson.Field
		StepDetails respjson.Field
		ThreadID    respjson.Field
		Type        respjson.Field
		Usage       respjson.Field
		ExtraFields map[string]respjson.Field
		
	} `json:"-"`
}

Represents a step in execution of a run.

Returns the unmodified JSON received from the API

The delta containing the fields that have changed on the run step.

Returns the unmodified JSON received from the API

Represents a run step delta i.e. any changed fields on a run step during streaming.

Returns the unmodified JSON received from the API

Details of the message creation by the run step.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := RunStepDeltaStepDetailsUnion.AsAny().(type) {
case openai.RunStepDeltaMessageDelta:
case openai.ToolCallDeltaObject:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

const (
	RunStepIncludeStepDetailsToolCallsFileSearchResultsContent RunStepInclude = "step_details.tool_calls[*].file_search.results[*].content"
)

The last error associated with this run step. Will be `null` if there are no errors.

Returns the unmodified JSON received from the API

The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.

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.

Use the following switch statement to find the correct variant

switch variant := RunStepStepDetailsUnion.AsAny().(type) {
case openai.MessageCreationStepDetails:
case openai.ToolCallsStepDetails:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

The type of run step, which can be either `message_creation` or `tool_calls`.

const (
	RunStepTypeMessageCreation RunStepType = "message_creation"
	RunStepTypeToolCalls       RunStepType = "tool_calls"
)

Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.

Returns the unmodified JSON received from the API

Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.

Returns the unmodified JSON received from the API

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.).

Returns the unmodified JSON received from the API

A ScoreModelGrader object that uses a model to assign a score to the input.

Returns the unmodified JSON received from the API

ToParam converts this ScoreModelGrader to a ScoreModelGraderParam.

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 ScoreModelGraderParam.Overrides()

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

Returns the unmodified JSON received from the API

An image input to the model.

Returns the unmodified JSON received from the API

type ScoreModelGraderInputContentInputImageParam struct {
	
	ImageURL string `json:"image_url,required"`
	
	
	Detail param.Opt[string] `json:"detail,omitzero"`
	
	
	
	Type constant.InputImage `json:"type,required"`
	
}

An image input to the model.

The properties ImageURL, Type are required.

A text output from the model.

Returns the unmodified JSON received from the API

type ScoreModelGraderInputContentOutputTextParam struct {
	
	Text string `json:"text,required"`
	
	
	
	Type constant.OutputText `json:"type,required"`
	
}

A text output from the model.

The properties Text, Type are required.

type ScoreModelGraderInputContentUnionParam struct {
	OfString                          param.Opt[string]                            `json:",omitzero,inline"`
	OfInputText                       *responses.ResponseInputTextParam            `json:",omitzero,inline"`
	OfOutputText                      *ScoreModelGraderInputContentOutputTextParam `json:",omitzero,inline"`
	OfInputImage                      *ScoreModelGraderInputContentInputImageParam `json:",omitzero,inline"`
	OfAnArrayOfInputTextAndInputImage []any                                        `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

The properties Content, Role are required.

A ScoreModelGrader object that uses a model to assign a score to the input.

The properties Input, Model, Name, Type are required.

type StaticFileChunkingStrategy struct {
	
	
	
	ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
	
	
	MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
	
	JSON struct {
		ChunkOverlapTokens respjson.Field
		MaxChunkSizeTokens respjson.Field
		ExtraFields        map[string]respjson.Field
		
	} `json:"-"`
}

Returns the unmodified JSON received from the API

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.Overrides()

Returns the unmodified JSON received from the API

Customize your own chunking strategy by setting chunk size and chunk overlap.

The properties Static, Type are required.

type StaticFileChunkingStrategyParam struct {
	
	
	
	ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
	
	
	MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
	
}

The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

Returns the unmodified JSON received from the API

ToParam converts this StringCheckGrader to a StringCheckGraderParam.

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 StringCheckGraderParam.Overrides()

type StringCheckGraderOperation string

The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.

A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.

The properties Input, Name, Operation, Reference, Type are required.

The hyperparameters used for the fine-tuning job.

type SupervisedHyperparametersBatchSizeUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

SupervisedHyperparametersBatchSizeUnionResp 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]

Returns the unmodified JSON received from the API

type SupervisedHyperparametersLearningRateMultiplierUnion struct {
	
	OfAuto  constant.Auto      `json:",omitzero,inline"`
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

SupervisedHyperparametersLearningRateMultiplierUnionResp 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]

Returns the unmodified JSON received from the API

type SupervisedHyperparametersNEpochsUnion struct {
	
	OfAuto constant.Auto    `json:",omitzero,inline"`
	OfInt  param.Opt[int64] `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

SupervisedHyperparametersNEpochsUnionResp 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]

Returns the unmodified JSON received from the API

The hyperparameters used for the fine-tuning job.

Returns the unmodified JSON received from the API

ToParam converts this SupervisedHyperparametersResp to a SupervisedHyperparameters.

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 SupervisedHyperparameters.Overrides()

Configuration for the supervised fine-tuning method.

Returns the unmodified JSON received from the API

ToParam converts this SupervisedMethod to a SupervisedMethodParam.

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 SupervisedMethodParam.Overrides()

Configuration for the supervised fine-tuning method.

Returns the unmodified JSON received from the API

The text content that is part of a message.

Returns the unmodified JSON received from the API

type TextContentBlockParam struct {
	
	Text string `json:"text,required"`
	
	
	
	Type constant.Text `json:"type,required"`
	
}

The text content that is part of a message.

The properties Text, Type are required.

Returns the unmodified JSON received from the API

The text content that is part of a message.

Returns the unmodified JSON received from the API

A TextSimilarityGrader object which grades text based on similarity metrics.

Returns the unmodified JSON received from the API

ToParam converts this TextSimilarityGrader to a TextSimilarityGraderParam.

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 TextSimilarityGraderParam.Overrides()

type TextSimilarityGraderEvaluationMetric string

The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`.

A TextSimilarityGrader object which grades text based on similarity metrics.

The properties EvaluationMetric, Input, Name, Reference, Type are required.

Returns the unmodified JSON received from the API

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.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type ThreadToolResourcesFileSearch struct {
	
	
	
	
	VectorStoreIDs []string `json:"vector_store_ids"`
	
	JSON struct {
		VectorStoreIDs respjson.Field
		ExtraFields    map[string]respjson.Field
		
	} `json:"-"`
}

Returns the unmodified JSON received from the API

Details of the tool call.

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := ToolCallDeltaUnion.AsAny().(type) {
case openai.CodeInterpreterToolCallDelta:
case openai.FileSearchToolCallDelta:
case openai.FunctionToolCallDelta:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := ToolCallUnion.AsAny().(type) {
case openai.CodeInterpreterToolCall:
case openai.FileSearchToolCall:
case openai.FunctionToolCall:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

Details of the tool call.

Returns the unmodified JSON received from the API

Represents a transcription response returned by model, based on the provided input.

Returns the unmodified JSON received from the API

type TranscriptionInclude string

Returns the unmodified JSON received from the API

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.

Use the following switch statement to find the correct variant

switch variant := TranscriptionStreamEventUnion.AsAny().(type) {
case openai.TranscriptionTextDeltaEvent:
case openai.TranscriptionTextDoneEvent:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Usage statistics for models billed by token usage.

Returns the unmodified JSON received from the API

Details about the input tokens billed for this request.

Returns the unmodified JSON received from the API

Usage statistics for models billed by audio input duration.

Returns the unmodified JSON received from the API

Usage statistics for models billed by token usage.

Returns the unmodified JSON received from the API

Details about the input tokens billed for this request.

Returns the unmodified JSON received from the API

TranscriptionUsageUnion contains all possible properties and values from TranscriptionUsageTokens, TranscriptionUsageDuration.

Use the TranscriptionUsageUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

Use the following switch statement to find the correct variant

switch variant := TranscriptionUsageUnion.AsAny().(type) {
case openai.TranscriptionUsageTokens:
case openai.TranscriptionUsageDuration:
default:
  fmt.Errorf("no variant present")
}

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

The Upload object can accept byte chunks in the form of Parts.

Returns the unmodified JSON received from the API

type UploadCompleteParams struct {
	
	PartIDs []string `json:"part_ids,omitzero,required"`
	
	
	Md5 param.Opt[string] `json:"md5,omitzero"`
	
}
type UploadNewParams struct {
	
	Bytes int64 `json:"bytes,required"`
	
	Filename string `json:"filename,required"`
	
	
	
	
	MimeType string `json:"mime_type,required"`
	
	
	
	
	
	
	Purpose FilePurpose `json:"purpose,omitzero,required"`
	
}

The upload Part represents a chunk of bytes we can add to an Upload object.

Returns the unmodified JSON received from the API

type UploadPartNewParams struct {
	
	Data io.Reader `json:"data,omitzero,required" format:"binary"`
	
}

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.

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.

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.

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.

Cancels the Upload. No Parts may be added after an Upload is cancelled.

The status of the Upload.

type VectorStore struct {
	
	ID string `json:"id,required"`
	
	CreatedAt  int64                 `json:"created_at,required"`
	FileCounts VectorStoreFileCounts `json:"file_counts,required"`
	
	LastActiveAt int64 `json:"last_active_at,required"`
	
	
	
	
	
	
	Metadata shared.Metadata `json:"metadata,required"`
	
	Name string `json:"name,required"`
	
	Object constant.VectorStore `json:"object,required"`
	
	
	
	
	
	Status VectorStoreStatus `json:"status,required"`
	
	UsageBytes int64 `json:"usage_bytes,required"`
	
	ExpiresAfter VectorStoreExpiresAfter `json:"expires_after"`
	
	ExpiresAt int64 `json:"expires_at,nullable"`
	
	JSON struct {
		ID           respjson.Field
		CreatedAt    respjson.Field
		FileCounts   respjson.Field
		LastActiveAt respjson.Field
		Metadata     respjson.Field
		Name         respjson.Field
		Object       respjson.Field
		Status       respjson.Field
		UsageBytes   respjson.Field
		ExpiresAfter respjson.Field
		ExpiresAt    respjson.Field
		ExtraFields  map[string]respjson.Field
		
	} `json:"-"`
}

A vector store is a collection of processed files can be used by the `file_search` tool.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

The expiration policy for a vector store.

Returns the unmodified JSON received from the API

A list of files attached to a vector store.

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

A batch of files attached to a vector store.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

type VectorStoreFileBatchListFilesParamsFilter string

Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.

type VectorStoreFileBatchListFilesParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

type VectorStoreFileBatchNewParamsAttributeUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

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.

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.

Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

Retrieves a vector store file batch.

Returns a list of vector store files in a batch.

Returns a list of vector store files in a batch.

Create a vector store file batch.

func (*VectorStoreFileBatchService) NewAndPoll

Create a vector store file batch and polls the API until the task is complete. Pass 0 for pollIntervalMs to enable default polling interval.

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

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 string

The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

The last error associated with this vector store file. Will be `null` if there are no errors.

Returns the unmodified JSON received from the API

type VectorStoreFileListParamsFilter string

Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.

type VectorStoreFileListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

type VectorStoreFileNewParamsAttributeUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

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.

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.

Retrieve the parsed contents of a vector store file.

Retrieve the parsed contents of a vector store file.

Retrieves a vector store file.

Returns a list of vector store files.

Returns a list of vector store files.

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.

Update attributes on a vector store file.

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

Add a file to a vector store and poll until processing is complete. Default polling interval is 1 second.

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.

type VectorStoreFileUpdateParamsAttributeUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type VectorStoreListParamsOrder string

Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

type VectorStoreNewParamsExpiresAfter struct {
	
	Days int64 `json:"days,required"`
	
	
	
	
	Anchor constant.LastActiveAt `json:"anchor,required"`
	
}

The expiration policy for a vector store.

The properties Anchor, Days are required.

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

Returns a pointer to the underlying variant's property, if present.

type VectorStoreSearchParamsQueryUnion struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `json:",omitzero,inline"`
	
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

type VectorStoreSearchParamsRankingOptions struct {
	ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"`
	
	Ranker string `json:"ranker,omitzero"`
	
}

Ranking options for search.

Returns the unmodified JSON received from the API

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]

Returns the unmodified JSON received from the API

Returns the unmodified JSON received from the API

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.

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.

Retrieves a vector store.

Returns a list of vector stores.

Returns a list of vector stores.

Search a vector store for relevant chunks based on a query and file attributes filter.

Search a vector store for relevant chunks based on a query and file attributes filter.

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.

type VectorStoreUpdateParamsExpiresAfter struct {
	
	Days int64 `json:"days,required"`
	
	
	
	
	Anchor constant.LastActiveAt `json:"anchor,required"`
	
}

The expiration policy for a vector store.

The properties Anchor, Days are required.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4