openaiclient

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

README

OpenAI Golang SDK Go Reference

This is an unofficial Golang SDK for the OpenAI API. It provides a simple and easy-to-use way to interact with the OpenAI API using Golang.

Installation

To install the OpenAI Golang SDK, simply run:

go get github.com/gopenai/openai-client

Usage

The OpenAI Golang SDK can be easily generated using a _oas/schema.yaml file that defines specification for the OpenAI API. To generate the SDK, project uses the ogen tool, which is a code generator for OpenAPI specifications. This allows you to easily update the SDK as the OpenAI API changes. If you change schema and want to generate sdk you can run the following command in makefile:

make generate

To use the OpenAI Golang SDK, you will need to have an API key for the OpenAI API. You can obtain an API key by creating an account on the OpenAI website.

Once you have your API key, you can create a new OpenAI client and start making requests to the API. Here's an example:

package main

import (
	"context"
	"fmt"

	openai "github.com/gopenai/openai-client"
)

func main() {
	// Replace SERVER_URL with your actual SERVER_URL key
	client, err := openai.NewClient("SERVER_URL")
	if err != nil {
		panic(err)
	}

	// Generate a text completion
	prompt := "Once upon a time,"
	req := &openai.CreateChatCompletionRequest{
		Model: "gpt-3.5-turbo",
		Messages: []openai.ChatCompletionRequestMessage{
			{
				Role:    openai.ChatCompletionRequestMessageRoleUser,
				Content: prompt,
			},
		},
	}
	response, err := client.CreateChatCompletion(context.Background(), req)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	// Print the completed text
	fmt.Println(response.Choices[0].Message.Value.Content)
}


This example generates a text completion using the OpenAI API, based on a prompt of "Once upon a time,". The resulting completed text is printed to the console.

You can also use bearer token auth. Here's an example:

package main

import (
	"context"
	"fmt"
	"os"

	openai "github.com/gopenai/openai-client"
)

func main() {
	// Replace SERVER_URL and API_TOKEN with your actual SERVER_URL and API_TOKEN values
	client, err := openai.NewBearerAuthClient(os.Getenv("SERVER_URL"), os.Getenv("API_TOKEN"))
	if err != nil {
		panic(err)
	}

	// Generate a text completion
	prompt := "Introduce himself please"
	req := &openai.CreateChatCompletionRequest{
		Model: "gpt-3.5-turbo",
		Messages: []openai.ChatCompletionRequestMessage{
			{
				Role:    openai.ChatCompletionRequestMessageRoleUser,
				Content: prompt,
			},
		},
	}
	response, err := client.CreateChatCompletion(context.Background(), req)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	// Print the completed text
	fmt.Println(response.Choices[0].Message.Value.Content)
}

Contributing

This SDK is open source, and contributions are welcome! If you have any bug reports, feature requests, or patches, please submit them through the GitHub issue tracker and pull request system.

Licence

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBearerAuthClient

func NewBearerAuthClient(serverURL, token string) (*bearerAuthClient, error)

NewBearerAuthClient creates new client ready for doing requests with bearer token.

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type CancelFineTuneParams

type CancelFineTuneParams struct {
	// The ID of the fine-tune job to cancel.
	FineTuneID string
}

CancelFineTuneParams is parameters of cancelFineTune operation.

type ChatCompletionRequestMessage

type ChatCompletionRequestMessage struct {
	// The role of the author of this message.
	Role ChatCompletionRequestMessageRole `json:"role"`
	// The contents of the message.
	Content string `json:"content"`
	// The name of the user in a multi-user chat.
	Name OptString `json:"name"`
}

Ref: #/components/schemas/ChatCompletionRequestMessage

func (*ChatCompletionRequestMessage) Decode

Decode decodes ChatCompletionRequestMessage from json.

func (*ChatCompletionRequestMessage) Encode

func (s *ChatCompletionRequestMessage) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ChatCompletionRequestMessage) GetContent

func (s *ChatCompletionRequestMessage) GetContent() string

GetContent returns the value of Content.

func (*ChatCompletionRequestMessage) GetName

GetName returns the value of Name.

func (*ChatCompletionRequestMessage) GetRole

GetRole returns the value of Role.

func (*ChatCompletionRequestMessage) MarshalJSON

func (s *ChatCompletionRequestMessage) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ChatCompletionRequestMessage) SetContent

func (s *ChatCompletionRequestMessage) SetContent(val string)

SetContent sets the value of Content.

func (*ChatCompletionRequestMessage) SetName

func (s *ChatCompletionRequestMessage) SetName(val OptString)

SetName sets the value of Name.

func (*ChatCompletionRequestMessage) SetRole

SetRole sets the value of Role.

func (*ChatCompletionRequestMessage) UnmarshalJSON

func (s *ChatCompletionRequestMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ChatCompletionRequestMessage) Validate

func (s *ChatCompletionRequestMessage) Validate() error

type ChatCompletionRequestMessageRole

type ChatCompletionRequestMessageRole string

The role of the author of this message.

const (
	ChatCompletionRequestMessageRoleSystem    ChatCompletionRequestMessageRole = "system"
	ChatCompletionRequestMessageRoleUser      ChatCompletionRequestMessageRole = "user"
	ChatCompletionRequestMessageRoleAssistant ChatCompletionRequestMessageRole = "assistant"
)

func (*ChatCompletionRequestMessageRole) Decode

Decode decodes ChatCompletionRequestMessageRole from json.

func (ChatCompletionRequestMessageRole) Encode

Encode encodes ChatCompletionRequestMessageRole as json.

func (ChatCompletionRequestMessageRole) MarshalJSON

func (s ChatCompletionRequestMessageRole) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (ChatCompletionRequestMessageRole) MarshalText

func (s ChatCompletionRequestMessageRole) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*ChatCompletionRequestMessageRole) UnmarshalJSON

func (s *ChatCompletionRequestMessageRole) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ChatCompletionRequestMessageRole) UnmarshalText

func (s *ChatCompletionRequestMessageRole) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (ChatCompletionRequestMessageRole) Validate

type ChatCompletionResponseMessage

type ChatCompletionResponseMessage struct {
	// The role of the author of this message.
	Role ChatCompletionResponseMessageRole `json:"role"`
	// The contents of the message.
	Content string `json:"content"`
}

Ref: #/components/schemas/ChatCompletionResponseMessage

func (*ChatCompletionResponseMessage) Decode

Decode decodes ChatCompletionResponseMessage from json.

func (*ChatCompletionResponseMessage) Encode

Encode implements json.Marshaler.

func (*ChatCompletionResponseMessage) GetContent

func (s *ChatCompletionResponseMessage) GetContent() string

GetContent returns the value of Content.

func (*ChatCompletionResponseMessage) GetRole

GetRole returns the value of Role.

func (*ChatCompletionResponseMessage) MarshalJSON

func (s *ChatCompletionResponseMessage) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ChatCompletionResponseMessage) SetContent

func (s *ChatCompletionResponseMessage) SetContent(val string)

SetContent sets the value of Content.

func (*ChatCompletionResponseMessage) SetRole

SetRole sets the value of Role.

func (*ChatCompletionResponseMessage) UnmarshalJSON

func (s *ChatCompletionResponseMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ChatCompletionResponseMessage) Validate

func (s *ChatCompletionResponseMessage) Validate() error

type ChatCompletionResponseMessageRole

type ChatCompletionResponseMessageRole string

The role of the author of this message.

const (
	ChatCompletionResponseMessageRoleSystem    ChatCompletionResponseMessageRole = "system"
	ChatCompletionResponseMessageRoleUser      ChatCompletionResponseMessageRole = "user"
	ChatCompletionResponseMessageRoleAssistant ChatCompletionResponseMessageRole = "assistant"
)

func (*ChatCompletionResponseMessageRole) Decode

Decode decodes ChatCompletionResponseMessageRole from json.

func (ChatCompletionResponseMessageRole) Encode

Encode encodes ChatCompletionResponseMessageRole as json.

func (ChatCompletionResponseMessageRole) MarshalJSON

func (s ChatCompletionResponseMessageRole) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (ChatCompletionResponseMessageRole) MarshalText

func (s ChatCompletionResponseMessageRole) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*ChatCompletionResponseMessageRole) UnmarshalJSON

func (s *ChatCompletionResponseMessageRole) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ChatCompletionResponseMessageRole) UnmarshalText

func (s *ChatCompletionResponseMessageRole) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (ChatCompletionResponseMessageRole) Validate

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) CancelFineTune

func (c *Client) CancelFineTune(ctx context.Context, params CancelFineTuneParams) (FineTune, error)

CancelFineTune invokes cancelFineTune operation.

Immediately cancel a fine-tune job.

POST /fine-tunes/{fine_tune_id}/cancel

func (*Client) CreateChatCompletion

func (c *Client) CreateChatCompletion(ctx context.Context, request *CreateChatCompletionRequest) (*CreateChatCompletionResponse, error)

CreateChatCompletion invokes createChatCompletion operation.

Creates a completion for the chat message.

POST /chat/completions

func (*Client) CreateEdit

func (c *Client) CreateEdit(ctx context.Context, request *CreateEditRequest) (*CreateEditResponse, error)

CreateEdit invokes createEdit operation.

Creates a new edit for the provided input, instruction, and parameters.

POST /edits

func (*Client) CreateFineTune

func (c *Client) CreateFineTune(ctx context.Context, request *CreateFineTuneRequest) (FineTune, error)

CreateFineTune invokes createFineTune operation.

Creates a job that fine-tunes a specified 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](/docs/guides/fine-tuning).

POST /fine-tunes

func (*Client) CreateImage

func (c *Client) CreateImage(ctx context.Context, request *CreateImageRequest) (ImagesResponse, error)

CreateImage invokes createImage operation.

Creates an image given a prompt.

POST /images/generations

func (*Client) CreateImageEdit

func (c *Client) CreateImageEdit(ctx context.Context, request *CreateImageEditRequestForm) (ImagesResponse, error)

CreateImageEdit invokes createImageEdit operation.

Creates an edited or extended image given an original image and a prompt.

POST /images/edits

func (*Client) CreateImageVariation

func (c *Client) CreateImageVariation(ctx context.Context, request *CreateImageVariationRequestForm) (ImagesResponse, error)

CreateImageVariation invokes createImageVariation operation.

Creates a variation of a given image.

POST /images/variations

func (*Client) CreateModeration

func (c *Client) CreateModeration(ctx context.Context, request *CreateModerationRequest) (*CreateModerationResponse, error)

CreateModeration invokes createModeration operation.

Classifies if text violates OpenAI's Content Policy.

POST /moderations

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, params DeleteFileParams) (*DeleteFileResponse, error)

DeleteFile invokes deleteFile operation.

Delete a file.

DELETE /files/{file_id}

func (*Client) DeleteModel

func (c *Client) DeleteModel(ctx context.Context, params DeleteModelParams) (*DeleteModelResponse, error)

DeleteModel invokes deleteModel operation.

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

DELETE /models/{model}

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, params DownloadFileParams) (string, error)

DownloadFile invokes downloadFile operation.

Returns the contents of the specified file.

GET /files/{file_id}/content

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context) (*ListFilesResponse, error)

ListFiles invokes listFiles operation.

Returns a list of files that belong to the user's organization.

GET /files

func (*Client) ListFineTuneEvents

func (c *Client) ListFineTuneEvents(ctx context.Context, params ListFineTuneEventsParams) (*ListFineTuneEventsResponse, error)

ListFineTuneEvents invokes listFineTuneEvents operation.

Get fine-grained status updates for a fine-tune job.

GET /fine-tunes/{fine_tune_id}/events

func (*Client) ListFineTunes

func (c *Client) ListFineTunes(ctx context.Context) (*ListFineTunesResponse, error)

ListFineTunes invokes listFineTunes operation.

List your organization's fine-tuning jobs.

GET /fine-tunes

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) (*ListModelsResponse, error)

ListModels invokes listModels operation.

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

GET /models

func (*Client) RetrieveFile

func (c *Client) RetrieveFile(ctx context.Context, params RetrieveFileParams) (OpenAIFile, error)

RetrieveFile invokes retrieveFile operation.

Returns information about a specific file.

GET /files/{file_id}

func (*Client) RetrieveFineTune

func (c *Client) RetrieveFineTune(ctx context.Context, params RetrieveFineTuneParams) (FineTune, error)

RetrieveFineTune invokes retrieveFineTune operation.

Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning).

GET /fine-tunes/{fine_tune_id}

func (*Client) RetrieveModel

func (c *Client) RetrieveModel(ctx context.Context, params RetrieveModelParams) (Model, error)

RetrieveModel invokes retrieveModel operation.

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

GET /models/{model}

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type CreateChatCompletionRequest

type CreateChatCompletionRequest struct {
	// ID of the model to use. Currently, only `gpt-3.5-turbo` and `gpt-3.5-turbo-0301` are supported.
	Model string `json:"model"`
	// The messages to generate chat completions for, in the [chat
	// format](/docs/guides/chat/introduction).
	Messages []ChatCompletionRequestMessage `json:"messages"`
	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output
	// more random, while lower values like 0.2 will make it more focused and deterministic.
	// We generally recommend altering this or `top_p` but not both.
	Temperature OptNilFloat64 `json:"temperature"`
	// An alternative to sampling with temperature, called nucleus sampling, where the model considers
	// the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the
	// top 10% probability mass are considered.
	// We generally recommend altering this or `temperature` but not both.
	TopP OptNilFloat64 `json:"top_p"`
	// How many chat completion choices to generate for each input message.
	N OptNilInt `json:"n"`
	// If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only
	// [server-sent events](https://developer.mozilla.
	// org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they
	// become available, with the stream terminated by a `data: [DONE]` message.
	Stream OptNilBool `json:"stream"`
	// Up to 4 sequences where the API will stop generating further tokens.
	Stop OptCreateChatCompletionRequestStop `json:"stop"`
	// The maximum number of tokens allowed for the generated answer. By default, the number of tokens
	// the model can return will be (4096 - prompt tokens).
	MaxTokens OptInt `json:"max_tokens"`
	// Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in
	// the text so far, increasing the model's likelihood to talk about new topics.
	// [See more information about frequency and presence penalties.
	// ](/docs/api-reference/parameter-details).
	PresencePenalty OptNilFloat64 `json:"presence_penalty"`
	// Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency
	// in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
	// [See more information about frequency and presence penalties.
	// ](/docs/api-reference/parameter-details).
	FrequencyPenalty OptNilFloat64 `json:"frequency_penalty"`
	// Modify the likelihood of specified tokens appearing in the completion.
	// Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an
	// associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated
	// by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1
	// should decrease or increase likelihood of selection; values like -100 or 100 should result in a
	// ban or exclusive selection of the relevant token.
	LogitBias OptCreateChatCompletionRequestLogitBias `json:"logit_bias"`
	// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	// [Learn more](/docs/guides/safety-best-practices/end-user-ids).
	User OptString `json:"user"`
}

Ref: #/components/schemas/CreateChatCompletionRequest

func (*CreateChatCompletionRequest) Decode

Decode decodes CreateChatCompletionRequest from json.

func (*CreateChatCompletionRequest) Encode

func (s *CreateChatCompletionRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateChatCompletionRequest) GetFrequencyPenalty

func (s *CreateChatCompletionRequest) GetFrequencyPenalty() OptNilFloat64

GetFrequencyPenalty returns the value of FrequencyPenalty.

func (*CreateChatCompletionRequest) GetLogitBias

GetLogitBias returns the value of LogitBias.

func (*CreateChatCompletionRequest) GetMaxTokens

func (s *CreateChatCompletionRequest) GetMaxTokens() OptInt

GetMaxTokens returns the value of MaxTokens.

func (*CreateChatCompletionRequest) GetMessages

GetMessages returns the value of Messages.

func (*CreateChatCompletionRequest) GetModel

func (s *CreateChatCompletionRequest) GetModel() string

GetModel returns the value of Model.

func (*CreateChatCompletionRequest) GetN

GetN returns the value of N.

func (*CreateChatCompletionRequest) GetPresencePenalty

func (s *CreateChatCompletionRequest) GetPresencePenalty() OptNilFloat64

GetPresencePenalty returns the value of PresencePenalty.

func (*CreateChatCompletionRequest) GetStop

GetStop returns the value of Stop.

func (*CreateChatCompletionRequest) GetStream

func (s *CreateChatCompletionRequest) GetStream() OptNilBool

GetStream returns the value of Stream.

func (*CreateChatCompletionRequest) GetTemperature

func (s *CreateChatCompletionRequest) GetTemperature() OptNilFloat64

GetTemperature returns the value of Temperature.

func (*CreateChatCompletionRequest) GetTopP

GetTopP returns the value of TopP.

func (*CreateChatCompletionRequest) GetUser

GetUser returns the value of User.

func (*CreateChatCompletionRequest) MarshalJSON

func (s *CreateChatCompletionRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateChatCompletionRequest) SetFrequencyPenalty

func (s *CreateChatCompletionRequest) SetFrequencyPenalty(val OptNilFloat64)

SetFrequencyPenalty sets the value of FrequencyPenalty.

func (*CreateChatCompletionRequest) SetLogitBias

SetLogitBias sets the value of LogitBias.

func (*CreateChatCompletionRequest) SetMaxTokens

func (s *CreateChatCompletionRequest) SetMaxTokens(val OptInt)

SetMaxTokens sets the value of MaxTokens.

func (*CreateChatCompletionRequest) SetMessages

SetMessages sets the value of Messages.

func (*CreateChatCompletionRequest) SetModel

func (s *CreateChatCompletionRequest) SetModel(val string)

SetModel sets the value of Model.

func (*CreateChatCompletionRequest) SetN

SetN sets the value of N.

func (*CreateChatCompletionRequest) SetPresencePenalty

func (s *CreateChatCompletionRequest) SetPresencePenalty(val OptNilFloat64)

SetPresencePenalty sets the value of PresencePenalty.

func (*CreateChatCompletionRequest) SetStop

SetStop sets the value of Stop.

func (*CreateChatCompletionRequest) SetStream

func (s *CreateChatCompletionRequest) SetStream(val OptNilBool)

SetStream sets the value of Stream.

func (*CreateChatCompletionRequest) SetTemperature

func (s *CreateChatCompletionRequest) SetTemperature(val OptNilFloat64)

SetTemperature sets the value of Temperature.

func (*CreateChatCompletionRequest) SetTopP

SetTopP sets the value of TopP.

func (*CreateChatCompletionRequest) SetUser

func (s *CreateChatCompletionRequest) SetUser(val OptString)

SetUser sets the value of User.

func (*CreateChatCompletionRequest) UnmarshalJSON

func (s *CreateChatCompletionRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateChatCompletionRequest) Validate

func (s *CreateChatCompletionRequest) Validate() error

type CreateChatCompletionRequestLogitBias

type CreateChatCompletionRequestLogitBias struct{}

Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.

func (*CreateChatCompletionRequestLogitBias) Decode

Decode decodes CreateChatCompletionRequestLogitBias from json.

func (*CreateChatCompletionRequestLogitBias) Encode

Encode implements json.Marshaler.

func (*CreateChatCompletionRequestLogitBias) MarshalJSON

func (s *CreateChatCompletionRequestLogitBias) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateChatCompletionRequestLogitBias) UnmarshalJSON

func (s *CreateChatCompletionRequestLogitBias) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateChatCompletionRequestStop

type CreateChatCompletionRequestStop struct {
	Type        CreateChatCompletionRequestStopType // switch on this field
	Null        struct{}
	String      string
	StringArray []string
}

Up to 4 sequences where the API will stop generating further tokens. CreateChatCompletionRequestStop represents sum type.

func NewNullCreateChatCompletionRequestStop

func NewNullCreateChatCompletionRequestStop(v struct{}) CreateChatCompletionRequestStop

NewNullCreateChatCompletionRequestStop returns new CreateChatCompletionRequestStop from struct{}.

func NewStringArrayCreateChatCompletionRequestStop

func NewStringArrayCreateChatCompletionRequestStop(v []string) CreateChatCompletionRequestStop

NewStringArrayCreateChatCompletionRequestStop returns new CreateChatCompletionRequestStop from []string.

func NewStringCreateChatCompletionRequestStop

func NewStringCreateChatCompletionRequestStop(v string) CreateChatCompletionRequestStop

NewStringCreateChatCompletionRequestStop returns new CreateChatCompletionRequestStop from string.

func (*CreateChatCompletionRequestStop) Decode

Decode decodes CreateChatCompletionRequestStop from json.

func (CreateChatCompletionRequestStop) Encode

Encode encodes CreateChatCompletionRequestStop as json.

func (CreateChatCompletionRequestStop) GetNull

func (s CreateChatCompletionRequestStop) GetNull() (v struct{}, ok bool)

GetNull returns struct{} and true boolean if CreateChatCompletionRequestStop is struct{}.

func (CreateChatCompletionRequestStop) GetString

func (s CreateChatCompletionRequestStop) GetString() (v string, ok bool)

GetString returns string and true boolean if CreateChatCompletionRequestStop is string.

func (CreateChatCompletionRequestStop) GetStringArray

func (s CreateChatCompletionRequestStop) GetStringArray() (v []string, ok bool)

GetStringArray returns []string and true boolean if CreateChatCompletionRequestStop is []string.

func (CreateChatCompletionRequestStop) IsNull

IsNull reports whether CreateChatCompletionRequestStop is struct{}.

func (CreateChatCompletionRequestStop) IsString

IsString reports whether CreateChatCompletionRequestStop is string.

func (CreateChatCompletionRequestStop) IsStringArray

func (s CreateChatCompletionRequestStop) IsStringArray() bool

IsStringArray reports whether CreateChatCompletionRequestStop is []string.

func (CreateChatCompletionRequestStop) MarshalJSON

func (s CreateChatCompletionRequestStop) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateChatCompletionRequestStop) SetNull

func (s *CreateChatCompletionRequestStop) SetNull(v struct{})

SetNull sets CreateChatCompletionRequestStop to struct{}.

func (*CreateChatCompletionRequestStop) SetString

func (s *CreateChatCompletionRequestStop) SetString(v string)

SetString sets CreateChatCompletionRequestStop to string.

func (*CreateChatCompletionRequestStop) SetStringArray

func (s *CreateChatCompletionRequestStop) SetStringArray(v []string)

SetStringArray sets CreateChatCompletionRequestStop to []string.

func (*CreateChatCompletionRequestStop) UnmarshalJSON

func (s *CreateChatCompletionRequestStop) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (CreateChatCompletionRequestStop) Validate

type CreateChatCompletionRequestStopType

type CreateChatCompletionRequestStopType string

CreateChatCompletionRequestStopType is oneOf type of CreateChatCompletionRequestStop.

const (
	NullCreateChatCompletionRequestStop        CreateChatCompletionRequestStopType = "struct{}"
	StringCreateChatCompletionRequestStop      CreateChatCompletionRequestStopType = "string"
	StringArrayCreateChatCompletionRequestStop CreateChatCompletionRequestStopType = "[]string"
)

Possible values for CreateChatCompletionRequestStopType.

type CreateChatCompletionResponse

type CreateChatCompletionResponse struct {
	ID      string                                    `json:"id"`
	Object  string                                    `json:"object"`
	Created int                                       `json:"created"`
	Model   string                                    `json:"model"`
	Choices []CreateChatCompletionResponseChoicesItem `json:"choices"`
	Usage   OptCreateChatCompletionResponseUsage      `json:"usage"`
}

Ref: #/components/schemas/CreateChatCompletionResponse

func (*CreateChatCompletionResponse) Decode

Decode decodes CreateChatCompletionResponse from json.

func (*CreateChatCompletionResponse) Encode

func (s *CreateChatCompletionResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateChatCompletionResponse) GetChoices

GetChoices returns the value of Choices.

func (*CreateChatCompletionResponse) GetCreated

func (s *CreateChatCompletionResponse) GetCreated() int

GetCreated returns the value of Created.

func (*CreateChatCompletionResponse) GetID

GetID returns the value of ID.

func (*CreateChatCompletionResponse) GetModel

func (s *CreateChatCompletionResponse) GetModel() string

GetModel returns the value of Model.

func (*CreateChatCompletionResponse) GetObject

func (s *CreateChatCompletionResponse) GetObject() string

GetObject returns the value of Object.

func (*CreateChatCompletionResponse) GetUsage

GetUsage returns the value of Usage.

func (*CreateChatCompletionResponse) MarshalJSON

func (s *CreateChatCompletionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateChatCompletionResponse) SetChoices

SetChoices sets the value of Choices.

func (*CreateChatCompletionResponse) SetCreated

func (s *CreateChatCompletionResponse) SetCreated(val int)

SetCreated sets the value of Created.

func (*CreateChatCompletionResponse) SetID

func (s *CreateChatCompletionResponse) SetID(val string)

SetID sets the value of ID.

func (*CreateChatCompletionResponse) SetModel

func (s *CreateChatCompletionResponse) SetModel(val string)

SetModel sets the value of Model.

func (*CreateChatCompletionResponse) SetObject

func (s *CreateChatCompletionResponse) SetObject(val string)

SetObject sets the value of Object.

func (*CreateChatCompletionResponse) SetUsage

SetUsage sets the value of Usage.

func (*CreateChatCompletionResponse) UnmarshalJSON

func (s *CreateChatCompletionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateChatCompletionResponse) Validate

func (s *CreateChatCompletionResponse) Validate() error

type CreateChatCompletionResponseChoicesItem

type CreateChatCompletionResponseChoicesItem struct {
	Index        OptInt                           `json:"index"`
	Message      OptChatCompletionResponseMessage `json:"message"`
	FinishReason OptString                        `json:"finish_reason"`
}

func (*CreateChatCompletionResponseChoicesItem) Decode

Decode decodes CreateChatCompletionResponseChoicesItem from json.

func (*CreateChatCompletionResponseChoicesItem) Encode

Encode implements json.Marshaler.

func (*CreateChatCompletionResponseChoicesItem) GetFinishReason

GetFinishReason returns the value of FinishReason.

func (*CreateChatCompletionResponseChoicesItem) GetIndex

GetIndex returns the value of Index.

func (*CreateChatCompletionResponseChoicesItem) GetMessage

GetMessage returns the value of Message.

func (*CreateChatCompletionResponseChoicesItem) MarshalJSON

func (s *CreateChatCompletionResponseChoicesItem) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateChatCompletionResponseChoicesItem) SetFinishReason

func (s *CreateChatCompletionResponseChoicesItem) SetFinishReason(val OptString)

SetFinishReason sets the value of FinishReason.

func (*CreateChatCompletionResponseChoicesItem) SetIndex

SetIndex sets the value of Index.

func (*CreateChatCompletionResponseChoicesItem) SetMessage

SetMessage sets the value of Message.

func (*CreateChatCompletionResponseChoicesItem) UnmarshalJSON

func (s *CreateChatCompletionResponseChoicesItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateChatCompletionResponseChoicesItem) Validate

type CreateChatCompletionResponseUsage

type CreateChatCompletionResponseUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

func (*CreateChatCompletionResponseUsage) Decode

Decode decodes CreateChatCompletionResponseUsage from json.

func (*CreateChatCompletionResponseUsage) Encode

Encode implements json.Marshaler.

func (*CreateChatCompletionResponseUsage) GetCompletionTokens

func (s *CreateChatCompletionResponseUsage) GetCompletionTokens() int

GetCompletionTokens returns the value of CompletionTokens.

func (*CreateChatCompletionResponseUsage) GetPromptTokens

func (s *CreateChatCompletionResponseUsage) GetPromptTokens() int

GetPromptTokens returns the value of PromptTokens.

func (*CreateChatCompletionResponseUsage) GetTotalTokens

func (s *CreateChatCompletionResponseUsage) GetTotalTokens() int

GetTotalTokens returns the value of TotalTokens.

func (*CreateChatCompletionResponseUsage) MarshalJSON

func (s *CreateChatCompletionResponseUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateChatCompletionResponseUsage) SetCompletionTokens

func (s *CreateChatCompletionResponseUsage) SetCompletionTokens(val int)

SetCompletionTokens sets the value of CompletionTokens.

func (*CreateChatCompletionResponseUsage) SetPromptTokens

func (s *CreateChatCompletionResponseUsage) SetPromptTokens(val int)

SetPromptTokens sets the value of PromptTokens.

func (*CreateChatCompletionResponseUsage) SetTotalTokens

func (s *CreateChatCompletionResponseUsage) SetTotalTokens(val int)

SetTotalTokens sets the value of TotalTokens.

func (*CreateChatCompletionResponseUsage) UnmarshalJSON

func (s *CreateChatCompletionResponseUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateEditRequest

type CreateEditRequest struct {
	// ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model
	// with this endpoint.
	Model string `json:"model"`
	// The input text to use as a starting point for the edit.
	Input OptNilString `json:"input"`
	// The instruction that tells the model how to edit the prompt.
	Instruction string `json:"instruction"`
	// How many edits to generate for the input and instruction.
	N OptNilInt `json:"n"`
	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output
	// more random, while lower values like 0.2 will make it more focused and deterministic.
	// We generally recommend altering this or `top_p` but not both.
	Temperature OptNilFloat64 `json:"temperature"`
	// An alternative to sampling with temperature, called nucleus sampling, where the model considers
	// the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the
	// top 10% probability mass are considered.
	// We generally recommend altering this or `temperature` but not both.
	TopP OptNilFloat64 `json:"top_p"`
}

Ref: #/components/schemas/CreateEditRequest

func (*CreateEditRequest) Decode

func (s *CreateEditRequest) Decode(d *jx.Decoder) error

Decode decodes CreateEditRequest from json.

func (*CreateEditRequest) Encode

func (s *CreateEditRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateEditRequest) GetInput

func (s *CreateEditRequest) GetInput() OptNilString

GetInput returns the value of Input.

func (*CreateEditRequest) GetInstruction

func (s *CreateEditRequest) GetInstruction() string

GetInstruction returns the value of Instruction.

func (*CreateEditRequest) GetModel

func (s *CreateEditRequest) GetModel() string

GetModel returns the value of Model.

func (*CreateEditRequest) GetN

func (s *CreateEditRequest) GetN() OptNilInt

GetN returns the value of N.

func (*CreateEditRequest) GetTemperature

func (s *CreateEditRequest) GetTemperature() OptNilFloat64

GetTemperature returns the value of Temperature.

func (*CreateEditRequest) GetTopP

func (s *CreateEditRequest) GetTopP() OptNilFloat64

GetTopP returns the value of TopP.

func (*CreateEditRequest) MarshalJSON

func (s *CreateEditRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateEditRequest) SetInput

func (s *CreateEditRequest) SetInput(val OptNilString)

SetInput sets the value of Input.

func (*CreateEditRequest) SetInstruction

func (s *CreateEditRequest) SetInstruction(val string)

SetInstruction sets the value of Instruction.

func (*CreateEditRequest) SetModel

func (s *CreateEditRequest) SetModel(val string)

SetModel sets the value of Model.

func (*CreateEditRequest) SetN

func (s *CreateEditRequest) SetN(val OptNilInt)

SetN sets the value of N.

func (*CreateEditRequest) SetTemperature

func (s *CreateEditRequest) SetTemperature(val OptNilFloat64)

SetTemperature sets the value of Temperature.

func (*CreateEditRequest) SetTopP

func (s *CreateEditRequest) SetTopP(val OptNilFloat64)

SetTopP sets the value of TopP.

func (*CreateEditRequest) UnmarshalJSON

func (s *CreateEditRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateEditRequest) Validate

func (s *CreateEditRequest) Validate() error

type CreateEditResponse

type CreateEditResponse struct {
	Object  string                          `json:"object"`
	Created int                             `json:"created"`
	Choices []CreateEditResponseChoicesItem `json:"choices"`
	Usage   CreateEditResponseUsage         `json:"usage"`
}

Ref: #/components/schemas/CreateEditResponse

func (*CreateEditResponse) Decode

func (s *CreateEditResponse) Decode(d *jx.Decoder) error

Decode decodes CreateEditResponse from json.

func (*CreateEditResponse) Encode

func (s *CreateEditResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateEditResponse) GetChoices

GetChoices returns the value of Choices.

func (*CreateEditResponse) GetCreated

func (s *CreateEditResponse) GetCreated() int

GetCreated returns the value of Created.

func (*CreateEditResponse) GetObject

func (s *CreateEditResponse) GetObject() string

GetObject returns the value of Object.

func (*CreateEditResponse) GetUsage

GetUsage returns the value of Usage.

func (*CreateEditResponse) MarshalJSON

func (s *CreateEditResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateEditResponse) SetChoices

SetChoices sets the value of Choices.

func (*CreateEditResponse) SetCreated

func (s *CreateEditResponse) SetCreated(val int)

SetCreated sets the value of Created.

func (*CreateEditResponse) SetObject

func (s *CreateEditResponse) SetObject(val string)

SetObject sets the value of Object.

func (*CreateEditResponse) SetUsage

SetUsage sets the value of Usage.

func (*CreateEditResponse) UnmarshalJSON

func (s *CreateEditResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateEditResponse) Validate

func (s *CreateEditResponse) Validate() error

type CreateEditResponseChoicesItem

type CreateEditResponseChoicesItem struct {
	Text         OptString                                   `json:"text"`
	Index        OptInt                                      `json:"index"`
	Logprobs     OptNilCreateEditResponseChoicesItemLogprobs `json:"logprobs"`
	FinishReason OptString                                   `json:"finish_reason"`
}

func (*CreateEditResponseChoicesItem) Decode

Decode decodes CreateEditResponseChoicesItem from json.

func (*CreateEditResponseChoicesItem) Encode

Encode implements json.Marshaler.

func (*CreateEditResponseChoicesItem) GetFinishReason

func (s *CreateEditResponseChoicesItem) GetFinishReason() OptString

GetFinishReason returns the value of FinishReason.

func (*CreateEditResponseChoicesItem) GetIndex

func (s *CreateEditResponseChoicesItem) GetIndex() OptInt

GetIndex returns the value of Index.

func (*CreateEditResponseChoicesItem) GetLogprobs

GetLogprobs returns the value of Logprobs.

func (*CreateEditResponseChoicesItem) GetText

GetText returns the value of Text.

func (*CreateEditResponseChoicesItem) MarshalJSON

func (s *CreateEditResponseChoicesItem) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateEditResponseChoicesItem) SetFinishReason

func (s *CreateEditResponseChoicesItem) SetFinishReason(val OptString)

SetFinishReason sets the value of FinishReason.

func (*CreateEditResponseChoicesItem) SetIndex

func (s *CreateEditResponseChoicesItem) SetIndex(val OptInt)

SetIndex sets the value of Index.

func (*CreateEditResponseChoicesItem) SetLogprobs

SetLogprobs sets the value of Logprobs.

func (*CreateEditResponseChoicesItem) SetText

func (s *CreateEditResponseChoicesItem) SetText(val OptString)

SetText sets the value of Text.

func (*CreateEditResponseChoicesItem) UnmarshalJSON

func (s *CreateEditResponseChoicesItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateEditResponseChoicesItem) Validate

func (s *CreateEditResponseChoicesItem) Validate() error

type CreateEditResponseChoicesItemLogprobs

type CreateEditResponseChoicesItemLogprobs struct {
	Tokens        []string                                               `json:"tokens"`
	TokenLogprobs []float64                                              `json:"token_logprobs"`
	TopLogprobs   []CreateEditResponseChoicesItemLogprobsTopLogprobsItem `json:"top_logprobs"`
	TextOffset    []int                                                  `json:"text_offset"`
}

func (*CreateEditResponseChoicesItemLogprobs) Decode

Decode decodes CreateEditResponseChoicesItemLogprobs from json.

func (*CreateEditResponseChoicesItemLogprobs) Encode

Encode implements json.Marshaler.

func (*CreateEditResponseChoicesItemLogprobs) GetTextOffset

func (s *CreateEditResponseChoicesItemLogprobs) GetTextOffset() []int

GetTextOffset returns the value of TextOffset.

func (*CreateEditResponseChoicesItemLogprobs) GetTokenLogprobs

func (s *CreateEditResponseChoicesItemLogprobs) GetTokenLogprobs() []float64

GetTokenLogprobs returns the value of TokenLogprobs.

func (*CreateEditResponseChoicesItemLogprobs) GetTokens

GetTokens returns the value of Tokens.

func (*CreateEditResponseChoicesItemLogprobs) GetTopLogprobs

GetTopLogprobs returns the value of TopLogprobs.

func (*CreateEditResponseChoicesItemLogprobs) MarshalJSON

func (s *CreateEditResponseChoicesItemLogprobs) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateEditResponseChoicesItemLogprobs) SetTextOffset

func (s *CreateEditResponseChoicesItemLogprobs) SetTextOffset(val []int)

SetTextOffset sets the value of TextOffset.

func (*CreateEditResponseChoicesItemLogprobs) SetTokenLogprobs

func (s *CreateEditResponseChoicesItemLogprobs) SetTokenLogprobs(val []float64)

SetTokenLogprobs sets the value of TokenLogprobs.

func (*CreateEditResponseChoicesItemLogprobs) SetTokens

func (s *CreateEditResponseChoicesItemLogprobs) SetTokens(val []string)

SetTokens sets the value of Tokens.

func (*CreateEditResponseChoicesItemLogprobs) SetTopLogprobs

SetTopLogprobs sets the value of TopLogprobs.

func (*CreateEditResponseChoicesItemLogprobs) UnmarshalJSON

func (s *CreateEditResponseChoicesItemLogprobs) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateEditResponseChoicesItemLogprobs) Validate

type CreateEditResponseChoicesItemLogprobsTopLogprobsItem

type CreateEditResponseChoicesItemLogprobsTopLogprobsItem struct{}

func (*CreateEditResponseChoicesItemLogprobsTopLogprobsItem) Decode

Decode decodes CreateEditResponseChoicesItemLogprobsTopLogprobsItem from json.

func (*CreateEditResponseChoicesItemLogprobsTopLogprobsItem) Encode

Encode implements json.Marshaler.

func (*CreateEditResponseChoicesItemLogprobsTopLogprobsItem) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (*CreateEditResponseChoicesItemLogprobsTopLogprobsItem) UnmarshalJSON

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateEditResponseUsage

type CreateEditResponseUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

func (*CreateEditResponseUsage) Decode

func (s *CreateEditResponseUsage) Decode(d *jx.Decoder) error

Decode decodes CreateEditResponseUsage from json.

func (*CreateEditResponseUsage) Encode

func (s *CreateEditResponseUsage) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateEditResponseUsage) GetCompletionTokens

func (s *CreateEditResponseUsage) GetCompletionTokens() int

GetCompletionTokens returns the value of CompletionTokens.

func (*CreateEditResponseUsage) GetPromptTokens

func (s *CreateEditResponseUsage) GetPromptTokens() int

GetPromptTokens returns the value of PromptTokens.

func (*CreateEditResponseUsage) GetTotalTokens

func (s *CreateEditResponseUsage) GetTotalTokens() int

GetTotalTokens returns the value of TotalTokens.

func (*CreateEditResponseUsage) MarshalJSON

func (s *CreateEditResponseUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateEditResponseUsage) SetCompletionTokens

func (s *CreateEditResponseUsage) SetCompletionTokens(val int)

SetCompletionTokens sets the value of CompletionTokens.

func (*CreateEditResponseUsage) SetPromptTokens

func (s *CreateEditResponseUsage) SetPromptTokens(val int)

SetPromptTokens sets the value of PromptTokens.

func (*CreateEditResponseUsage) SetTotalTokens

func (s *CreateEditResponseUsage) SetTotalTokens(val int)

SetTotalTokens sets the value of TotalTokens.

func (*CreateEditResponseUsage) UnmarshalJSON

func (s *CreateEditResponseUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateFineTuneRequest

type CreateFineTuneRequest struct {
	// The ID of an uploaded file that contains training data.
	// See [upload file](/docs/api-reference/files/upload) for how to upload a file.
	// Your dataset must be formatted as a JSONL file, where each training
	// example is a JSON object with the keys "prompt" and "completion".
	// Additionally, you must upload your file with the purpose `fine-tune`.
	// See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details.
	TrainingFile string `json:"training_file"`
	// The ID of an uploaded file that contains validation data.
	// If you provide this file, the data is used to generate validation
	// metrics periodically during fine-tuning. These metrics can be viewed in
	// the [fine-tuning results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).
	// Your train and validation data should be mutually exclusive.
	// Your dataset must be formatted as a JSONL file, where each validation
	// example is a JSON object with the keys "prompt" and "completion".
	// Additionally, you must upload your file with the purpose `fine-tune`.
	// See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details.
	ValidationFile OptNilString `json:"validation_file"`
	// The name of the base model to fine-tune. You can select one of "ada",
	// "babbage", "curie", "davinci", or a fine-tuned model created after 2022-04-21.
	// To learn more about these models, see the
	// [Models](https://platform.openai.com/docs/models) documentation.
	Model OptNilString `json:"model"`
	// The number of epochs to train the model for. An epoch refers to one
	// full cycle through the training dataset.
	NEpochs OptNilInt `json:"n_epochs"`
	// The batch size to use for training. The batch size is the number of
	// training examples used to train a single forward and backward pass.
	// By default, the batch size will be dynamically configured to be
	// ~0.2% of the number of examples in the training set, capped at 256 -
	// in general, we've found that larger batch sizes tend to work better
	// for larger datasets.
	BatchSize OptNilInt `json:"batch_size"`
	// The learning rate multiplier to use for training.
	// The fine-tuning learning rate is the original learning rate used for
	// pretraining multiplied by this value.
	// By default, the learning rate multiplier is the 0.05, 0.1, or 0.2
	// depending on final `batch_size` (larger learning rates tend to
	// perform better with larger batch sizes). We recommend experimenting
	// with values in the range 0.02 to 0.2 to see what produces the best
	// results.
	LearningRateMultiplier OptNilFloat64 `json:"learning_rate_multiplier"`
	// The weight to use for loss on the prompt tokens. This controls how
	// much the model tries to learn to generate the prompt (as compared
	// to the completion which always has a weight of 1.0), and can add
	// a stabilizing effect to training when completions are short.
	// If prompts are extremely long (relative to completions), it may make
	// sense to reduce this weight so as to avoid over-prioritizing
	// learning the prompt.
	PromptLossWeight OptNilFloat64 `json:"prompt_loss_weight"`
	// If set, we calculate classification-specific metrics such as accuracy
	// and F-1 score using the validation set at the end of every epoch.
	// These metrics can be viewed in the [results
	// file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).
	// In order to compute classification metrics, you must provide a
	// `validation_file`. Additionally, you must
	// specify `classification_n_classes` for multiclass classification or
	// `classification_positive_class` for binary classification.
	ComputeClassificationMetrics OptNilBool `json:"compute_classification_metrics"`
	// The number of classes in a classification task.
	// This parameter is required for multiclass classification.
	ClassificationNClasses OptNilInt `json:"classification_n_classes"`
	// The positive class in binary classification.
	// This parameter is needed to generate precision, recall, and F1
	// metrics when doing binary classification.
	ClassificationPositiveClass OptNilString `json:"classification_positive_class"`
	// If this is provided, we calculate F-beta scores at the specified
	// beta values. The F-beta score is a generalization of F-1 score.
	// This is only used for binary classification.
	// With a beta of 1 (i.e. the F-1 score), precision and recall are
	// given the same weight. A larger beta score puts more weight on
	// recall and less on precision. A smaller beta score puts more weight
	// on precision and less on recall.
	ClassificationBetas OptNilFloat64Array `json:"classification_betas"`
	// A string of up to 40 characters that will be added to your fine-tuned model name.
	// For example, a `suffix` of "custom-model-name" would produce a model name like
	// `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`.
	Suffix OptNilString `json:"suffix"`
}

Ref: #/components/schemas/CreateFineTuneRequest

func (*CreateFineTuneRequest) Decode

func (s *CreateFineTuneRequest) Decode(d *jx.Decoder) error

Decode decodes CreateFineTuneRequest from json.

func (*CreateFineTuneRequest) Encode

func (s *CreateFineTuneRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateFineTuneRequest) GetBatchSize

func (s *CreateFineTuneRequest) GetBatchSize() OptNilInt

GetBatchSize returns the value of BatchSize.

func (*CreateFineTuneRequest) GetClassificationBetas

func (s *CreateFineTuneRequest) GetClassificationBetas() OptNilFloat64Array

GetClassificationBetas returns the value of ClassificationBetas.

func (*CreateFineTuneRequest) GetClassificationNClasses

func (s *CreateFineTuneRequest) GetClassificationNClasses() OptNilInt

GetClassificationNClasses returns the value of ClassificationNClasses.

func (*CreateFineTuneRequest) GetClassificationPositiveClass

func (s *CreateFineTuneRequest) GetClassificationPositiveClass() OptNilString

GetClassificationPositiveClass returns the value of ClassificationPositiveClass.

func (*CreateFineTuneRequest) GetComputeClassificationMetrics

func (s *CreateFineTuneRequest) GetComputeClassificationMetrics() OptNilBool

GetComputeClassificationMetrics returns the value of ComputeClassificationMetrics.

func (*CreateFineTuneRequest) GetLearningRateMultiplier

func (s *CreateFineTuneRequest) GetLearningRateMultiplier() OptNilFloat64

GetLearningRateMultiplier returns the value of LearningRateMultiplier.

func (*CreateFineTuneRequest) GetModel

func (s *CreateFineTuneRequest) GetModel() OptNilString

GetModel returns the value of Model.

func (*CreateFineTuneRequest) GetNEpochs

func (s *CreateFineTuneRequest) GetNEpochs() OptNilInt

GetNEpochs returns the value of NEpochs.

func (*CreateFineTuneRequest) GetPromptLossWeight

func (s *CreateFineTuneRequest) GetPromptLossWeight() OptNilFloat64

GetPromptLossWeight returns the value of PromptLossWeight.

func (*CreateFineTuneRequest) GetSuffix

func (s *CreateFineTuneRequest) GetSuffix() OptNilString

GetSuffix returns the value of Suffix.

func (*CreateFineTuneRequest) GetTrainingFile

func (s *CreateFineTuneRequest) GetTrainingFile() string

GetTrainingFile returns the value of TrainingFile.

func (*CreateFineTuneRequest) GetValidationFile

func (s *CreateFineTuneRequest) GetValidationFile() OptNilString

GetValidationFile returns the value of ValidationFile.

func (*CreateFineTuneRequest) MarshalJSON

func (s *CreateFineTuneRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateFineTuneRequest) SetBatchSize

func (s *CreateFineTuneRequest) SetBatchSize(val OptNilInt)

SetBatchSize sets the value of BatchSize.

func (*CreateFineTuneRequest) SetClassificationBetas

func (s *CreateFineTuneRequest) SetClassificationBetas(val OptNilFloat64Array)

SetClassificationBetas sets the value of ClassificationBetas.

func (*CreateFineTuneRequest) SetClassificationNClasses

func (s *CreateFineTuneRequest) SetClassificationNClasses(val OptNilInt)

SetClassificationNClasses sets the value of ClassificationNClasses.

func (*CreateFineTuneRequest) SetClassificationPositiveClass

func (s *CreateFineTuneRequest) SetClassificationPositiveClass(val OptNilString)

SetClassificationPositiveClass sets the value of ClassificationPositiveClass.

func (*CreateFineTuneRequest) SetComputeClassificationMetrics

func (s *CreateFineTuneRequest) SetComputeClassificationMetrics(val OptNilBool)

SetComputeClassificationMetrics sets the value of ComputeClassificationMetrics.

func (*CreateFineTuneRequest) SetLearningRateMultiplier

func (s *CreateFineTuneRequest) SetLearningRateMultiplier(val OptNilFloat64)

SetLearningRateMultiplier sets the value of LearningRateMultiplier.

func (*CreateFineTuneRequest) SetModel

func (s *CreateFineTuneRequest) SetModel(val OptNilString)

SetModel sets the value of Model.

func (*CreateFineTuneRequest) SetNEpochs

func (s *CreateFineTuneRequest) SetNEpochs(val OptNilInt)

SetNEpochs sets the value of NEpochs.

func (*CreateFineTuneRequest) SetPromptLossWeight

func (s *CreateFineTuneRequest) SetPromptLossWeight(val OptNilFloat64)

SetPromptLossWeight sets the value of PromptLossWeight.

func (*CreateFineTuneRequest) SetSuffix

func (s *CreateFineTuneRequest) SetSuffix(val OptNilString)

SetSuffix sets the value of Suffix.

func (*CreateFineTuneRequest) SetTrainingFile

func (s *CreateFineTuneRequest) SetTrainingFile(val string)

SetTrainingFile sets the value of TrainingFile.

func (*CreateFineTuneRequest) SetValidationFile

func (s *CreateFineTuneRequest) SetValidationFile(val OptNilString)

SetValidationFile sets the value of ValidationFile.

func (*CreateFineTuneRequest) UnmarshalJSON

func (s *CreateFineTuneRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateFineTuneRequest) Validate

func (s *CreateFineTuneRequest) Validate() error

type CreateImageEditRequest

type CreateImageEditRequest struct {
	// The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided,
	// image must have transparency, which will be used as the mask.
	Image string `json:"image"`
	// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
	// `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as
	// `image`.
	Mask OptString `json:"mask"`
	// A text description of the desired image(s). The maximum length is 1000 characters.
	Prompt string `json:"prompt"`
	// The number of images to generate. Must be between 1 and 10.
	N OptNilInt `json:"n"`
	// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
	Size OptNilCreateImageEditRequestSize `json:"size"`
	// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
	ResponseFormat OptNilCreateImageEditRequestResponseFormat `json:"response_format"`
	// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	// [Learn more](/docs/guides/safety-best-practices/end-user-ids).
	User OptString `json:"user"`
}

Ref: #/components/schemas/CreateImageEditRequest

func (*CreateImageEditRequest) GetImage

func (s *CreateImageEditRequest) GetImage() string

GetImage returns the value of Image.

func (*CreateImageEditRequest) GetMask

func (s *CreateImageEditRequest) GetMask() OptString

GetMask returns the value of Mask.

func (*CreateImageEditRequest) GetN

GetN returns the value of N.

func (*CreateImageEditRequest) GetPrompt

func (s *CreateImageEditRequest) GetPrompt() string

GetPrompt returns the value of Prompt.

func (*CreateImageEditRequest) GetResponseFormat

GetResponseFormat returns the value of ResponseFormat.

func (*CreateImageEditRequest) GetSize

GetSize returns the value of Size.

func (*CreateImageEditRequest) GetUser

func (s *CreateImageEditRequest) GetUser() OptString

GetUser returns the value of User.

func (*CreateImageEditRequest) SetImage

func (s *CreateImageEditRequest) SetImage(val string)

SetImage sets the value of Image.

func (*CreateImageEditRequest) SetMask

func (s *CreateImageEditRequest) SetMask(val OptString)

SetMask sets the value of Mask.

func (*CreateImageEditRequest) SetN

func (s *CreateImageEditRequest) SetN(val OptNilInt)

SetN sets the value of N.

func (*CreateImageEditRequest) SetPrompt

func (s *CreateImageEditRequest) SetPrompt(val string)

SetPrompt sets the value of Prompt.

func (*CreateImageEditRequest) SetResponseFormat

SetResponseFormat sets the value of ResponseFormat.

func (*CreateImageEditRequest) SetSize

SetSize sets the value of Size.

func (*CreateImageEditRequest) SetUser

func (s *CreateImageEditRequest) SetUser(val OptString)

SetUser sets the value of User.

func (*CreateImageEditRequest) Validate

func (s *CreateImageEditRequest) Validate() error

type CreateImageEditRequestForm

type CreateImageEditRequestForm struct {
	// The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided,
	// image must have transparency, which will be used as the mask.
	Image ht.MultipartFile `json:"image"`
	// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
	// `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as
	// `image`.
	Mask OptMultipartFile `json:"mask"`
	// A text description of the desired image(s). The maximum length is 1000 characters.
	Prompt string `json:"prompt"`
	// The number of images to generate. Must be between 1 and 10.
	N OptNilInt `json:"n"`
	// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
	Size OptNilCreateImageEditRequestSize `json:"size"`
	// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
	ResponseFormat OptNilCreateImageEditRequestResponseFormat `json:"response_format"`
	// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	// [Learn more](/docs/guides/safety-best-practices/end-user-ids).
	User OptString `json:"user"`
}

Ref: #/components/schemas/CreateImageEditRequest

func (*CreateImageEditRequestForm) GetImage

GetImage returns the value of Image.

func (*CreateImageEditRequestForm) GetMask

GetMask returns the value of Mask.

func (*CreateImageEditRequestForm) GetN

GetN returns the value of N.

func (*CreateImageEditRequestForm) GetPrompt

func (s *CreateImageEditRequestForm) GetPrompt() string

GetPrompt returns the value of Prompt.

func (*CreateImageEditRequestForm) GetResponseFormat

GetResponseFormat returns the value of ResponseFormat.

func (*CreateImageEditRequestForm) GetSize

GetSize returns the value of Size.

func (*CreateImageEditRequestForm) GetUser

GetUser returns the value of User.

func (*CreateImageEditRequestForm) SetImage

func (s *CreateImageEditRequestForm) SetImage(val ht.MultipartFile)

SetImage sets the value of Image.

func (*CreateImageEditRequestForm) SetMask

SetMask sets the value of Mask.

func (*CreateImageEditRequestForm) SetN

SetN sets the value of N.

func (*CreateImageEditRequestForm) SetPrompt

func (s *CreateImageEditRequestForm) SetPrompt(val string)

SetPrompt sets the value of Prompt.

func (*CreateImageEditRequestForm) SetResponseFormat

SetResponseFormat sets the value of ResponseFormat.

func (*CreateImageEditRequestForm) SetSize

SetSize sets the value of Size.

func (*CreateImageEditRequestForm) SetUser

func (s *CreateImageEditRequestForm) SetUser(val OptString)

SetUser sets the value of User.

func (*CreateImageEditRequestForm) Validate

func (s *CreateImageEditRequestForm) Validate() error

type CreateImageEditRequestResponseFormat

type CreateImageEditRequestResponseFormat string

The format in which the generated images are returned. Must be one of `url` or `b64_json`.

const (
	CreateImageEditRequestResponseFormatURL     CreateImageEditRequestResponseFormat = "url"
	CreateImageEditRequestResponseFormatB64JSON CreateImageEditRequestResponseFormat = "b64_json"
)

func (CreateImageEditRequestResponseFormat) MarshalText

func (s CreateImageEditRequestResponseFormat) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*CreateImageEditRequestResponseFormat) UnmarshalText

func (s *CreateImageEditRequestResponseFormat) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CreateImageEditRequestResponseFormat) Validate

type CreateImageEditRequestSize

type CreateImageEditRequestSize string

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

const (
	CreateImageEditRequestSize256x256   CreateImageEditRequestSize = "256x256"
	CreateImageEditRequestSize512x512   CreateImageEditRequestSize = "512x512"
	CreateImageEditRequestSize1024x1024 CreateImageEditRequestSize = "1024x1024"
)

func (CreateImageEditRequestSize) MarshalText

func (s CreateImageEditRequestSize) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*CreateImageEditRequestSize) UnmarshalText

func (s *CreateImageEditRequestSize) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CreateImageEditRequestSize) Validate

func (s CreateImageEditRequestSize) Validate() error

type CreateImageRequest

type CreateImageRequest struct {
	// A text description of the desired image(s). The maximum length is 1000 characters.
	Prompt string `json:"prompt"`
	// The number of images to generate. Must be between 1 and 10.
	N OptNilInt `json:"n"`
	// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
	Size OptNilCreateImageRequestSize `json:"size"`
	// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
	ResponseFormat OptNilCreateImageRequestResponseFormat `json:"response_format"`
	// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	// [Learn more](/docs/guides/safety-best-practices/end-user-ids).
	User OptString `json:"user"`
}

Ref: #/components/schemas/CreateImageRequest

func (*CreateImageRequest) Decode

func (s *CreateImageRequest) Decode(d *jx.Decoder) error

Decode decodes CreateImageRequest from json.

func (*CreateImageRequest) Encode

func (s *CreateImageRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateImageRequest) GetN

func (s *CreateImageRequest) GetN() OptNilInt

GetN returns the value of N.

func (*CreateImageRequest) GetPrompt

func (s *CreateImageRequest) GetPrompt() string

GetPrompt returns the value of Prompt.

func (*CreateImageRequest) GetResponseFormat

GetResponseFormat returns the value of ResponseFormat.

func (*CreateImageRequest) GetSize

GetSize returns the value of Size.

func (*CreateImageRequest) GetUser

func (s *CreateImageRequest) GetUser() OptString

GetUser returns the value of User.

func (*CreateImageRequest) MarshalJSON

func (s *CreateImageRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateImageRequest) SetN

func (s *CreateImageRequest) SetN(val OptNilInt)

SetN sets the value of N.

func (*CreateImageRequest) SetPrompt

func (s *CreateImageRequest) SetPrompt(val string)

SetPrompt sets the value of Prompt.

func (*CreateImageRequest) SetResponseFormat

SetResponseFormat sets the value of ResponseFormat.

func (*CreateImageRequest) SetSize

SetSize sets the value of Size.

func (*CreateImageRequest) SetUser

func (s *CreateImageRequest) SetUser(val OptString)

SetUser sets the value of User.

func (*CreateImageRequest) UnmarshalJSON

func (s *CreateImageRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateImageRequest) Validate

func (s *CreateImageRequest) Validate() error

type CreateImageRequestResponseFormat

type CreateImageRequestResponseFormat string

The format in which the generated images are returned. Must be one of `url` or `b64_json`.

const (
	CreateImageRequestResponseFormatURL     CreateImageRequestResponseFormat = "url"
	CreateImageRequestResponseFormatB64JSON CreateImageRequestResponseFormat = "b64_json"
)

func (*CreateImageRequestResponseFormat) Decode

Decode decodes CreateImageRequestResponseFormat from json.

func (CreateImageRequestResponseFormat) Encode

Encode encodes CreateImageRequestResponseFormat as json.

func (CreateImageRequestResponseFormat) MarshalJSON

func (s CreateImageRequestResponseFormat) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (CreateImageRequestResponseFormat) MarshalText

func (s CreateImageRequestResponseFormat) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*CreateImageRequestResponseFormat) UnmarshalJSON

func (s *CreateImageRequestResponseFormat) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateImageRequestResponseFormat) UnmarshalText

func (s *CreateImageRequestResponseFormat) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CreateImageRequestResponseFormat) Validate

type CreateImageRequestSize

type CreateImageRequestSize string

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

const (
	CreateImageRequestSize256x256   CreateImageRequestSize = "256x256"
	CreateImageRequestSize512x512   CreateImageRequestSize = "512x512"
	CreateImageRequestSize1024x1024 CreateImageRequestSize = "1024x1024"
)

func (*CreateImageRequestSize) Decode

func (s *CreateImageRequestSize) Decode(d *jx.Decoder) error

Decode decodes CreateImageRequestSize from json.

func (CreateImageRequestSize) Encode

func (s CreateImageRequestSize) Encode(e *jx.Encoder)

Encode encodes CreateImageRequestSize as json.

func (CreateImageRequestSize) MarshalJSON

func (s CreateImageRequestSize) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (CreateImageRequestSize) MarshalText

func (s CreateImageRequestSize) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*CreateImageRequestSize) UnmarshalJSON

func (s *CreateImageRequestSize) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateImageRequestSize) UnmarshalText

func (s *CreateImageRequestSize) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CreateImageRequestSize) Validate

func (s CreateImageRequestSize) Validate() error

type CreateImageVariationRequest

type CreateImageVariationRequest struct {
	// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and
	// square.
	Image string `json:"image"`
	// The number of images to generate. Must be between 1 and 10.
	N OptNilInt `json:"n"`
	// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
	Size OptNilCreateImageVariationRequestSize `json:"size"`
	// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
	ResponseFormat OptNilCreateImageVariationRequestResponseFormat `json:"response_format"`
	// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	// [Learn more](/docs/guides/safety-best-practices/end-user-ids).
	User OptString `json:"user"`
}

Ref: #/components/schemas/CreateImageVariationRequest

func (*CreateImageVariationRequest) GetImage

func (s *CreateImageVariationRequest) GetImage() string

GetImage returns the value of Image.

func (*CreateImageVariationRequest) GetN

GetN returns the value of N.

func (*CreateImageVariationRequest) GetResponseFormat

GetResponseFormat returns the value of ResponseFormat.

func (*CreateImageVariationRequest) GetSize

GetSize returns the value of Size.

func (*CreateImageVariationRequest) GetUser

GetUser returns the value of User.

func (*CreateImageVariationRequest) SetImage

func (s *CreateImageVariationRequest) SetImage(val string)

SetImage sets the value of Image.

func (*CreateImageVariationRequest) SetN

SetN sets the value of N.

func (*CreateImageVariationRequest) SetResponseFormat

SetResponseFormat sets the value of ResponseFormat.

func (*CreateImageVariationRequest) SetSize

SetSize sets the value of Size.

func (*CreateImageVariationRequest) SetUser

func (s *CreateImageVariationRequest) SetUser(val OptString)

SetUser sets the value of User.

func (*CreateImageVariationRequest) Validate

func (s *CreateImageVariationRequest) Validate() error

type CreateImageVariationRequestForm

type CreateImageVariationRequestForm struct {
	// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and
	// square.
	Image ht.MultipartFile `json:"image"`
	// The number of images to generate. Must be between 1 and 10.
	N OptNilInt `json:"n"`
	// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
	Size OptNilCreateImageVariationRequestSize `json:"size"`
	// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
	ResponseFormat OptNilCreateImageVariationRequestResponseFormat `json:"response_format"`
	// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	// [Learn more](/docs/guides/safety-best-practices/end-user-ids).
	User OptString `json:"user"`
}

Ref: #/components/schemas/CreateImageVariationRequest

func (*CreateImageVariationRequestForm) GetImage

GetImage returns the value of Image.

func (*CreateImageVariationRequestForm) GetN

GetN returns the value of N.

func (*CreateImageVariationRequestForm) GetResponseFormat

GetResponseFormat returns the value of ResponseFormat.

func (*CreateImageVariationRequestForm) GetSize

GetSize returns the value of Size.

func (*CreateImageVariationRequestForm) GetUser

GetUser returns the value of User.

func (*CreateImageVariationRequestForm) SetImage

SetImage sets the value of Image.

func (*CreateImageVariationRequestForm) SetN

SetN sets the value of N.

func (*CreateImageVariationRequestForm) SetResponseFormat

SetResponseFormat sets the value of ResponseFormat.

func (*CreateImageVariationRequestForm) SetSize

SetSize sets the value of Size.

func (*CreateImageVariationRequestForm) SetUser

SetUser sets the value of User.

func (*CreateImageVariationRequestForm) Validate

func (s *CreateImageVariationRequestForm) Validate() error

type CreateImageVariationRequestResponseFormat

type CreateImageVariationRequestResponseFormat string

The format in which the generated images are returned. Must be one of `url` or `b64_json`.

const (
	CreateImageVariationRequestResponseFormatURL     CreateImageVariationRequestResponseFormat = "url"
	CreateImageVariationRequestResponseFormatB64JSON CreateImageVariationRequestResponseFormat = "b64_json"
)

func (CreateImageVariationRequestResponseFormat) MarshalText

MarshalText implements encoding.TextMarshaler.

func (*CreateImageVariationRequestResponseFormat) UnmarshalText

func (s *CreateImageVariationRequestResponseFormat) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CreateImageVariationRequestResponseFormat) Validate

type CreateImageVariationRequestSize

type CreateImageVariationRequestSize string

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

const (
	CreateImageVariationRequestSize256x256   CreateImageVariationRequestSize = "256x256"
	CreateImageVariationRequestSize512x512   CreateImageVariationRequestSize = "512x512"
	CreateImageVariationRequestSize1024x1024 CreateImageVariationRequestSize = "1024x1024"
)

func (CreateImageVariationRequestSize) MarshalText

func (s CreateImageVariationRequestSize) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*CreateImageVariationRequestSize) UnmarshalText

func (s *CreateImageVariationRequestSize) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CreateImageVariationRequestSize) Validate

type CreateModerationRequest

type CreateModerationRequest struct {
	// The input text to classify.
	Input CreateModerationRequestInput `json:"input"`
	// Two content moderations models are available: `text-moderation-stable` and
	// `text-moderation-latest`.
	// The default is `text-moderation-latest` which will be automatically upgraded over time. This
	// ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will
	// provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be
	// slightly lower than for `text-moderation-latest`.
	Model OptString `json:"model"`
}

Ref: #/components/schemas/CreateModerationRequest

func (*CreateModerationRequest) Decode

func (s *CreateModerationRequest) Decode(d *jx.Decoder) error

Decode decodes CreateModerationRequest from json.

func (*CreateModerationRequest) Encode

func (s *CreateModerationRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateModerationRequest) GetInput

GetInput returns the value of Input.

func (*CreateModerationRequest) GetModel

func (s *CreateModerationRequest) GetModel() OptString

GetModel returns the value of Model.

func (*CreateModerationRequest) MarshalJSON

func (s *CreateModerationRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateModerationRequest) SetInput

SetInput sets the value of Input.

func (*CreateModerationRequest) SetModel

func (s *CreateModerationRequest) SetModel(val OptString)

SetModel sets the value of Model.

func (*CreateModerationRequest) UnmarshalJSON

func (s *CreateModerationRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateModerationRequest) Validate

func (s *CreateModerationRequest) Validate() error

type CreateModerationRequestInput

type CreateModerationRequestInput struct {
	Type        CreateModerationRequestInputType // switch on this field
	String      string
	StringArray []string
}

The input text to classify. CreateModerationRequestInput represents sum type.

func NewStringArrayCreateModerationRequestInput

func NewStringArrayCreateModerationRequestInput(v []string) CreateModerationRequestInput

NewStringArrayCreateModerationRequestInput returns new CreateModerationRequestInput from []string.

func NewStringCreateModerationRequestInput

func NewStringCreateModerationRequestInput(v string) CreateModerationRequestInput

NewStringCreateModerationRequestInput returns new CreateModerationRequestInput from string.

func (*CreateModerationRequestInput) Decode

Decode decodes CreateModerationRequestInput from json.

func (CreateModerationRequestInput) Encode

Encode encodes CreateModerationRequestInput as json.

func (CreateModerationRequestInput) GetString

func (s CreateModerationRequestInput) GetString() (v string, ok bool)

GetString returns string and true boolean if CreateModerationRequestInput is string.

func (CreateModerationRequestInput) GetStringArray

func (s CreateModerationRequestInput) GetStringArray() (v []string, ok bool)

GetStringArray returns []string and true boolean if CreateModerationRequestInput is []string.

func (CreateModerationRequestInput) IsString

func (s CreateModerationRequestInput) IsString() bool

IsString reports whether CreateModerationRequestInput is string.

func (CreateModerationRequestInput) IsStringArray

func (s CreateModerationRequestInput) IsStringArray() bool

IsStringArray reports whether CreateModerationRequestInput is []string.

func (CreateModerationRequestInput) MarshalJSON

func (s CreateModerationRequestInput) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateModerationRequestInput) SetString

func (s *CreateModerationRequestInput) SetString(v string)

SetString sets CreateModerationRequestInput to string.

func (*CreateModerationRequestInput) SetStringArray

func (s *CreateModerationRequestInput) SetStringArray(v []string)

SetStringArray sets CreateModerationRequestInput to []string.

func (*CreateModerationRequestInput) UnmarshalJSON

func (s *CreateModerationRequestInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (CreateModerationRequestInput) Validate

func (s CreateModerationRequestInput) Validate() error

type CreateModerationRequestInputType

type CreateModerationRequestInputType string

CreateModerationRequestInputType is oneOf type of CreateModerationRequestInput.

const (
	StringCreateModerationRequestInput      CreateModerationRequestInputType = "string"
	StringArrayCreateModerationRequestInput CreateModerationRequestInputType = "[]string"
)

Possible values for CreateModerationRequestInputType.

type CreateModerationResponse

type CreateModerationResponse struct {
	ID      string                                `json:"id"`
	Model   string                                `json:"model"`
	Results []CreateModerationResponseResultsItem `json:"results"`
}

Ref: #/components/schemas/CreateModerationResponse

func (*CreateModerationResponse) Decode

func (s *CreateModerationResponse) Decode(d *jx.Decoder) error

Decode decodes CreateModerationResponse from json.

func (*CreateModerationResponse) Encode

func (s *CreateModerationResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateModerationResponse) GetID

func (s *CreateModerationResponse) GetID() string

GetID returns the value of ID.

func (*CreateModerationResponse) GetModel

func (s *CreateModerationResponse) GetModel() string

GetModel returns the value of Model.

func (*CreateModerationResponse) GetResults

GetResults returns the value of Results.

func (*CreateModerationResponse) MarshalJSON

func (s *CreateModerationResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateModerationResponse) SetID

func (s *CreateModerationResponse) SetID(val string)

SetID sets the value of ID.

func (*CreateModerationResponse) SetModel

func (s *CreateModerationResponse) SetModel(val string)

SetModel sets the value of Model.

func (*CreateModerationResponse) SetResults

SetResults sets the value of Results.

func (*CreateModerationResponse) UnmarshalJSON

func (s *CreateModerationResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateModerationResponse) Validate

func (s *CreateModerationResponse) Validate() error

type CreateModerationResponseResultsItem

type CreateModerationResponseResultsItem struct {
	Flagged        bool                                              `json:"flagged"`
	Categories     CreateModerationResponseResultsItemCategories     `json:"categories"`
	CategoryScores CreateModerationResponseResultsItemCategoryScores `json:"category_scores"`
}

func (*CreateModerationResponseResultsItem) Decode

Decode decodes CreateModerationResponseResultsItem from json.

func (*CreateModerationResponseResultsItem) Encode

Encode implements json.Marshaler.

func (*CreateModerationResponseResultsItem) GetCategories

GetCategories returns the value of Categories.

func (*CreateModerationResponseResultsItem) GetCategoryScores

GetCategoryScores returns the value of CategoryScores.

func (*CreateModerationResponseResultsItem) GetFlagged

func (s *CreateModerationResponseResultsItem) GetFlagged() bool

GetFlagged returns the value of Flagged.

func (*CreateModerationResponseResultsItem) MarshalJSON

func (s *CreateModerationResponseResultsItem) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateModerationResponseResultsItem) SetCategories

SetCategories sets the value of Categories.

func (*CreateModerationResponseResultsItem) SetCategoryScores

SetCategoryScores sets the value of CategoryScores.

func (*CreateModerationResponseResultsItem) SetFlagged

func (s *CreateModerationResponseResultsItem) SetFlagged(val bool)

SetFlagged sets the value of Flagged.

func (*CreateModerationResponseResultsItem) UnmarshalJSON

func (s *CreateModerationResponseResultsItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateModerationResponseResultsItem) Validate

type CreateModerationResponseResultsItemCategories

type CreateModerationResponseResultsItemCategories struct {
	Hate                 bool `json:"hate"`
	HateSlashThreatening bool `json:"hate/threatening"`
	SelfMinusHarm        bool `json:"self-harm"`
	Sexual               bool `json:"sexual"`
	SexualSlashMinors    bool `json:"sexual/minors"`
	Violence             bool `json:"violence"`
	ViolenceSlashGraphic bool `json:"violence/graphic"`
}

func (*CreateModerationResponseResultsItemCategories) Decode

Decode decodes CreateModerationResponseResultsItemCategories from json.

func (*CreateModerationResponseResultsItemCategories) Encode

Encode implements json.Marshaler.

func (*CreateModerationResponseResultsItemCategories) GetHate

GetHate returns the value of Hate.

func (*CreateModerationResponseResultsItemCategories) GetHateSlashThreatening

func (s *CreateModerationResponseResultsItemCategories) GetHateSlashThreatening() bool

GetHateSlashThreatening returns the value of HateSlashThreatening.

func (*CreateModerationResponseResultsItemCategories) GetSelfMinusHarm

GetSelfMinusHarm returns the value of SelfMinusHarm.

func (*CreateModerationResponseResultsItemCategories) GetSexual

GetSexual returns the value of Sexual.

func (*CreateModerationResponseResultsItemCategories) GetSexualSlashMinors

func (s *CreateModerationResponseResultsItemCategories) GetSexualSlashMinors() bool

GetSexualSlashMinors returns the value of SexualSlashMinors.

func (*CreateModerationResponseResultsItemCategories) GetViolence

GetViolence returns the value of Violence.

func (*CreateModerationResponseResultsItemCategories) GetViolenceSlashGraphic

func (s *CreateModerationResponseResultsItemCategories) GetViolenceSlashGraphic() bool

GetViolenceSlashGraphic returns the value of ViolenceSlashGraphic.

func (*CreateModerationResponseResultsItemCategories) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (*CreateModerationResponseResultsItemCategories) SetHate

SetHate sets the value of Hate.

func (*CreateModerationResponseResultsItemCategories) SetHateSlashThreatening

func (s *CreateModerationResponseResultsItemCategories) SetHateSlashThreatening(val bool)

SetHateSlashThreatening sets the value of HateSlashThreatening.

func (*CreateModerationResponseResultsItemCategories) SetSelfMinusHarm

func (s *CreateModerationResponseResultsItemCategories) SetSelfMinusHarm(val bool)

SetSelfMinusHarm sets the value of SelfMinusHarm.

func (*CreateModerationResponseResultsItemCategories) SetSexual

SetSexual sets the value of Sexual.

func (*CreateModerationResponseResultsItemCategories) SetSexualSlashMinors

func (s *CreateModerationResponseResultsItemCategories) SetSexualSlashMinors(val bool)

SetSexualSlashMinors sets the value of SexualSlashMinors.

func (*CreateModerationResponseResultsItemCategories) SetViolence

SetViolence sets the value of Violence.

func (*CreateModerationResponseResultsItemCategories) SetViolenceSlashGraphic

func (s *CreateModerationResponseResultsItemCategories) SetViolenceSlashGraphic(val bool)

SetViolenceSlashGraphic sets the value of ViolenceSlashGraphic.

func (*CreateModerationResponseResultsItemCategories) UnmarshalJSON

func (s *CreateModerationResponseResultsItemCategories) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateModerationResponseResultsItemCategoryScores

type CreateModerationResponseResultsItemCategoryScores struct {
	Hate                 float64 `json:"hate"`
	HateSlashThreatening float64 `json:"hate/threatening"`
	SelfMinusHarm        float64 `json:"self-harm"`
	Sexual               float64 `json:"sexual"`
	SexualSlashMinors    float64 `json:"sexual/minors"`
	Violence             float64 `json:"violence"`
	ViolenceSlashGraphic float64 `json:"violence/graphic"`
}

func (*CreateModerationResponseResultsItemCategoryScores) Decode

Decode decodes CreateModerationResponseResultsItemCategoryScores from json.

func (*CreateModerationResponseResultsItemCategoryScores) Encode

Encode implements json.Marshaler.

func (*CreateModerationResponseResultsItemCategoryScores) GetHate

GetHate returns the value of Hate.

func (*CreateModerationResponseResultsItemCategoryScores) GetHateSlashThreatening

func (s *CreateModerationResponseResultsItemCategoryScores) GetHateSlashThreatening() float64

GetHateSlashThreatening returns the value of HateSlashThreatening.

func (*CreateModerationResponseResultsItemCategoryScores) GetSelfMinusHarm

GetSelfMinusHarm returns the value of SelfMinusHarm.

func (*CreateModerationResponseResultsItemCategoryScores) GetSexual

GetSexual returns the value of Sexual.

func (*CreateModerationResponseResultsItemCategoryScores) GetSexualSlashMinors

GetSexualSlashMinors returns the value of SexualSlashMinors.

func (*CreateModerationResponseResultsItemCategoryScores) GetViolence

GetViolence returns the value of Violence.

func (*CreateModerationResponseResultsItemCategoryScores) GetViolenceSlashGraphic

func (s *CreateModerationResponseResultsItemCategoryScores) GetViolenceSlashGraphic() float64

GetViolenceSlashGraphic returns the value of ViolenceSlashGraphic.

func (*CreateModerationResponseResultsItemCategoryScores) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (*CreateModerationResponseResultsItemCategoryScores) SetHate

SetHate sets the value of Hate.

func (*CreateModerationResponseResultsItemCategoryScores) SetHateSlashThreatening

func (s *CreateModerationResponseResultsItemCategoryScores) SetHateSlashThreatening(val float64)

SetHateSlashThreatening sets the value of HateSlashThreatening.

func (*CreateModerationResponseResultsItemCategoryScores) SetSelfMinusHarm

SetSelfMinusHarm sets the value of SelfMinusHarm.

func (*CreateModerationResponseResultsItemCategoryScores) SetSexual

SetSexual sets the value of Sexual.

func (*CreateModerationResponseResultsItemCategoryScores) SetSexualSlashMinors

func (s *CreateModerationResponseResultsItemCategoryScores) SetSexualSlashMinors(val float64)

SetSexualSlashMinors sets the value of SexualSlashMinors.

func (*CreateModerationResponseResultsItemCategoryScores) SetViolence

SetViolence sets the value of Violence.

func (*CreateModerationResponseResultsItemCategoryScores) SetViolenceSlashGraphic

func (s *CreateModerationResponseResultsItemCategoryScores) SetViolenceSlashGraphic(val float64)

SetViolenceSlashGraphic sets the value of ViolenceSlashGraphic.

func (*CreateModerationResponseResultsItemCategoryScores) UnmarshalJSON

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateModerationResponseResultsItemCategoryScores) Validate

type DeleteFileParams

type DeleteFileParams struct {
	// The ID of the file to use for this request.
	FileID string
}

DeleteFileParams is parameters of deleteFile operation.

type DeleteFileResponse

type DeleteFileResponse struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

Ref: #/components/schemas/DeleteFileResponse

func (*DeleteFileResponse) Decode

func (s *DeleteFileResponse) Decode(d *jx.Decoder) error

Decode decodes DeleteFileResponse from json.

func (*DeleteFileResponse) Encode

func (s *DeleteFileResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*DeleteFileResponse) GetDeleted

func (s *DeleteFileResponse) GetDeleted() bool

GetDeleted returns the value of Deleted.

func (*DeleteFileResponse) GetID

func (s *DeleteFileResponse) GetID() string

GetID returns the value of ID.

func (*DeleteFileResponse) GetObject

func (s *DeleteFileResponse) GetObject() string

GetObject returns the value of Object.

func (*DeleteFileResponse) MarshalJSON

func (s *DeleteFileResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*DeleteFileResponse) SetDeleted

func (s *DeleteFileResponse) SetDeleted(val bool)

SetDeleted sets the value of Deleted.

func (*DeleteFileResponse) SetID

func (s *DeleteFileResponse) SetID(val string)

SetID sets the value of ID.

func (*DeleteFileResponse) SetObject

func (s *DeleteFileResponse) SetObject(val string)

SetObject sets the value of Object.

func (*DeleteFileResponse) UnmarshalJSON

func (s *DeleteFileResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type DeleteModelParams

type DeleteModelParams struct {
	// The model to delete.
	Model string
}

DeleteModelParams is parameters of deleteModel operation.

type DeleteModelResponse

type DeleteModelResponse struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

Ref: #/components/schemas/DeleteModelResponse

func (*DeleteModelResponse) Decode

func (s *DeleteModelResponse) Decode(d *jx.Decoder) error

Decode decodes DeleteModelResponse from json.

func (*DeleteModelResponse) Encode

func (s *DeleteModelResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*DeleteModelResponse) GetDeleted

func (s *DeleteModelResponse) GetDeleted() bool

GetDeleted returns the value of Deleted.

func (*DeleteModelResponse) GetID

func (s *DeleteModelResponse) GetID() string

GetID returns the value of ID.

func (*DeleteModelResponse) GetObject

func (s *DeleteModelResponse) GetObject() string

GetObject returns the value of Object.

func (*DeleteModelResponse) MarshalJSON

func (s *DeleteModelResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*DeleteModelResponse) SetDeleted

func (s *DeleteModelResponse) SetDeleted(val bool)

SetDeleted sets the value of Deleted.

func (*DeleteModelResponse) SetID

func (s *DeleteModelResponse) SetID(val string)

SetID sets the value of ID.

func (*DeleteModelResponse) SetObject

func (s *DeleteModelResponse) SetObject(val string)

SetObject sets the value of Object.

func (*DeleteModelResponse) UnmarshalJSON

func (s *DeleteModelResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type DownloadFileParams

type DownloadFileParams struct {
	// The ID of the file to use for this request.
	FileID string
}

DownloadFileParams is parameters of downloadFile operation.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type FineTune

type FineTune jx.Raw

func (*FineTune) Decode

func (s *FineTune) Decode(d *jx.Decoder) error

Decode decodes FineTune from json.

func (FineTune) Encode

func (s FineTune) Encode(e *jx.Encoder)

Encode encodes FineTune as json.

func (FineTune) MarshalJSON

func (s FineTune) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*FineTune) UnmarshalJSON

func (s *FineTune) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type FineTuneEvent

type FineTuneEvent jx.Raw

func (*FineTuneEvent) Decode

func (s *FineTuneEvent) Decode(d *jx.Decoder) error

Decode decodes FineTuneEvent from json.

func (FineTuneEvent) Encode

func (s FineTuneEvent) Encode(e *jx.Encoder)

Encode encodes FineTuneEvent as json.

func (FineTuneEvent) MarshalJSON

func (s FineTuneEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*FineTuneEvent) UnmarshalJSON

func (s *FineTuneEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Handler

type Handler interface {
	// CancelFineTune implements cancelFineTune operation.
	//
	// Immediately cancel a fine-tune job.
	//
	// POST /fine-tunes/{fine_tune_id}/cancel
	CancelFineTune(ctx context.Context, params CancelFineTuneParams) (FineTune, error)
	// CreateChatCompletion implements createChatCompletion operation.
	//
	// Creates a completion for the chat message.
	//
	// POST /chat/completions
	CreateChatCompletion(ctx context.Context, req *CreateChatCompletionRequest) (*CreateChatCompletionResponse, error)
	// CreateEdit implements createEdit operation.
	//
	// Creates a new edit for the provided input, instruction, and parameters.
	//
	// POST /edits
	CreateEdit(ctx context.Context, req *CreateEditRequest) (*CreateEditResponse, error)
	// CreateFineTune implements createFineTune operation.
	//
	// Creates a job that fine-tunes a specified 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](/docs/guides/fine-tuning).
	//
	// POST /fine-tunes
	CreateFineTune(ctx context.Context, req *CreateFineTuneRequest) (FineTune, error)
	// CreateImage implements createImage operation.
	//
	// Creates an image given a prompt.
	//
	// POST /images/generations
	CreateImage(ctx context.Context, req *CreateImageRequest) (ImagesResponse, error)
	// CreateImageEdit implements createImageEdit operation.
	//
	// Creates an edited or extended image given an original image and a prompt.
	//
	// POST /images/edits
	CreateImageEdit(ctx context.Context, req *CreateImageEditRequestForm) (ImagesResponse, error)
	// CreateImageVariation implements createImageVariation operation.
	//
	// Creates a variation of a given image.
	//
	// POST /images/variations
	CreateImageVariation(ctx context.Context, req *CreateImageVariationRequestForm) (ImagesResponse, error)
	// CreateModeration implements createModeration operation.
	//
	// Classifies if text violates OpenAI's Content Policy.
	//
	// POST /moderations
	CreateModeration(ctx context.Context, req *CreateModerationRequest) (*CreateModerationResponse, error)
	// DeleteFile implements deleteFile operation.
	//
	// Delete a file.
	//
	// DELETE /files/{file_id}
	DeleteFile(ctx context.Context, params DeleteFileParams) (*DeleteFileResponse, error)
	// DeleteModel implements deleteModel operation.
	//
	// Delete a fine-tuned model. You must have the Owner role in your organization.
	//
	// DELETE /models/{model}
	DeleteModel(ctx context.Context, params DeleteModelParams) (*DeleteModelResponse, error)
	// DownloadFile implements downloadFile operation.
	//
	// Returns the contents of the specified file.
	//
	// GET /files/{file_id}/content
	DownloadFile(ctx context.Context, params DownloadFileParams) (string, error)
	// ListFiles implements listFiles operation.
	//
	// Returns a list of files that belong to the user's organization.
	//
	// GET /files
	ListFiles(ctx context.Context) (*ListFilesResponse, error)
	// ListFineTuneEvents implements listFineTuneEvents operation.
	//
	// Get fine-grained status updates for a fine-tune job.
	//
	// GET /fine-tunes/{fine_tune_id}/events
	ListFineTuneEvents(ctx context.Context, params ListFineTuneEventsParams) (*ListFineTuneEventsResponse, error)
	// ListFineTunes implements listFineTunes operation.
	//
	// List your organization's fine-tuning jobs.
	//
	// GET /fine-tunes
	ListFineTunes(ctx context.Context) (*ListFineTunesResponse, error)
	// ListModels implements listModels operation.
	//
	// Lists the currently available models, and provides basic information about each one such as the
	// owner and availability.
	//
	// GET /models
	ListModels(ctx context.Context) (*ListModelsResponse, error)
	// RetrieveFile implements retrieveFile operation.
	//
	// Returns information about a specific file.
	//
	// GET /files/{file_id}
	RetrieveFile(ctx context.Context, params RetrieveFileParams) (OpenAIFile, error)
	// RetrieveFineTune implements retrieveFineTune operation.
	//
	// Gets info about the fine-tune job.
	// [Learn more about Fine-tuning](/docs/guides/fine-tuning).
	//
	// GET /fine-tunes/{fine_tune_id}
	RetrieveFineTune(ctx context.Context, params RetrieveFineTuneParams) (FineTune, error)
	// RetrieveModel implements retrieveModel operation.
	//
	// Retrieves a model instance, providing basic information about the model such as the owner and
	// permissioning.
	//
	// GET /models/{model}
	RetrieveModel(ctx context.Context, params RetrieveModelParams) (Model, error)
}

Handler handles operations described by OpenAPI v3 specification.

type ImagesResponse

type ImagesResponse jx.Raw

func (*ImagesResponse) Decode

func (s *ImagesResponse) Decode(d *jx.Decoder) error

Decode decodes ImagesResponse from json.

func (ImagesResponse) Encode

func (s ImagesResponse) Encode(e *jx.Encoder)

Encode encodes ImagesResponse as json.

func (ImagesResponse) MarshalJSON

func (s ImagesResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ImagesResponse) UnmarshalJSON

func (s *ImagesResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type ListFilesResponse

type ListFilesResponse struct {
	Object string       `json:"object"`
	Data   []OpenAIFile `json:"data"`
}

Ref: #/components/schemas/ListFilesResponse

func (*ListFilesResponse) Decode

func (s *ListFilesResponse) Decode(d *jx.Decoder) error

Decode decodes ListFilesResponse from json.

func (*ListFilesResponse) Encode

func (s *ListFilesResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ListFilesResponse) GetData

func (s *ListFilesResponse) GetData() []OpenAIFile

GetData returns the value of Data.

func (*ListFilesResponse) GetObject

func (s *ListFilesResponse) GetObject() string

GetObject returns the value of Object.

func (*ListFilesResponse) MarshalJSON

func (s *ListFilesResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ListFilesResponse) SetData

func (s *ListFilesResponse) SetData(val []OpenAIFile)

SetData sets the value of Data.

func (*ListFilesResponse) SetObject

func (s *ListFilesResponse) SetObject(val string)

SetObject sets the value of Object.

func (*ListFilesResponse) UnmarshalJSON

func (s *ListFilesResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ListFilesResponse) Validate

func (s *ListFilesResponse) Validate() error

type ListFineTuneEventsParams

type ListFineTuneEventsParams struct {
	// The ID of the fine-tune job to get events for.
	FineTuneID string
	// Whether to stream events for the fine-tune job. If set to true,
	// events will be sent as data-only
	// [server-sent events](https://developer.mozilla.
	// org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
	// as they become available. The stream will terminate with a
	// `data: [DONE]` message when the job is finished (succeeded, cancelled,
	// or failed).
	// If set to false, only events generated so far will be returned.
	Stream OptBool
}

ListFineTuneEventsParams is parameters of listFineTuneEvents operation.

type ListFineTuneEventsResponse

type ListFineTuneEventsResponse struct {
	Object string          `json:"object"`
	Data   []FineTuneEvent `json:"data"`
}

Ref: #/components/schemas/ListFineTuneEventsResponse

func (*ListFineTuneEventsResponse) Decode

Decode decodes ListFineTuneEventsResponse from json.

func (*ListFineTuneEventsResponse) Encode

func (s *ListFineTuneEventsResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ListFineTuneEventsResponse) GetData

GetData returns the value of Data.

func (*ListFineTuneEventsResponse) GetObject

func (s *ListFineTuneEventsResponse) GetObject() string

GetObject returns the value of Object.

func (*ListFineTuneEventsResponse) MarshalJSON

func (s *ListFineTuneEventsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ListFineTuneEventsResponse) SetData

func (s *ListFineTuneEventsResponse) SetData(val []FineTuneEvent)

SetData sets the value of Data.

func (*ListFineTuneEventsResponse) SetObject

func (s *ListFineTuneEventsResponse) SetObject(val string)

SetObject sets the value of Object.

func (*ListFineTuneEventsResponse) UnmarshalJSON

func (s *ListFineTuneEventsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ListFineTuneEventsResponse) Validate

func (s *ListFineTuneEventsResponse) Validate() error

type ListFineTunesResponse

type ListFineTunesResponse struct {
	Object string     `json:"object"`
	Data   []FineTune `json:"data"`
}

Ref: #/components/schemas/ListFineTunesResponse

func (*ListFineTunesResponse) Decode

func (s *ListFineTunesResponse) Decode(d *jx.Decoder) error

Decode decodes ListFineTunesResponse from json.

func (*ListFineTunesResponse) Encode

func (s *ListFineTunesResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ListFineTunesResponse) GetData

func (s *ListFineTunesResponse) GetData() []FineTune

GetData returns the value of Data.

func (*ListFineTunesResponse) GetObject

func (s *ListFineTunesResponse) GetObject() string

GetObject returns the value of Object.

func (*ListFineTunesResponse) MarshalJSON

func (s *ListFineTunesResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ListFineTunesResponse) SetData

func (s *ListFineTunesResponse) SetData(val []FineTune)

SetData sets the value of Data.

func (*ListFineTunesResponse) SetObject

func (s *ListFineTunesResponse) SetObject(val string)

SetObject sets the value of Object.

func (*ListFineTunesResponse) UnmarshalJSON

func (s *ListFineTunesResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ListFineTunesResponse) Validate

func (s *ListFineTunesResponse) Validate() error

type ListModelsResponse

type ListModelsResponse struct {
	Object string  `json:"object"`
	Data   []Model `json:"data"`
}

Ref: #/components/schemas/ListModelsResponse

func (*ListModelsResponse) Decode

func (s *ListModelsResponse) Decode(d *jx.Decoder) error

Decode decodes ListModelsResponse from json.

func (*ListModelsResponse) Encode

func (s *ListModelsResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ListModelsResponse) GetData

func (s *ListModelsResponse) GetData() []Model

GetData returns the value of Data.

func (*ListModelsResponse) GetObject

func (s *ListModelsResponse) GetObject() string

GetObject returns the value of Object.

func (*ListModelsResponse) MarshalJSON

func (s *ListModelsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ListModelsResponse) SetData

func (s *ListModelsResponse) SetData(val []Model)

SetData sets the value of Data.

func (*ListModelsResponse) SetObject

func (s *ListModelsResponse) SetObject(val string)

SetObject sets the value of Object.

func (*ListModelsResponse) UnmarshalJSON

func (s *ListModelsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ListModelsResponse) Validate

func (s *ListModelsResponse) Validate() error

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type Model

type Model jx.Raw

func (*Model) Decode

func (s *Model) Decode(d *jx.Decoder) error

Decode decodes Model from json.

func (Model) Encode

func (s Model) Encode(e *jx.Encoder)

Encode encodes Model as json.

func (Model) MarshalJSON

func (s Model) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Model) UnmarshalJSON

func (s *Model) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OpenAIFile

type OpenAIFile jx.Raw

func (*OpenAIFile) Decode

func (s *OpenAIFile) Decode(d *jx.Decoder) error

Decode decodes OpenAIFile from json.

func (OpenAIFile) Encode

func (s OpenAIFile) Encode(e *jx.Encoder)

Encode encodes OpenAIFile as json.

func (OpenAIFile) MarshalJSON

func (s OpenAIFile) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*OpenAIFile) UnmarshalJSON

func (s *OpenAIFile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptBool

type OptBool struct {
	Value bool
	Set   bool
}

OptBool is optional bool.

func NewOptBool

func NewOptBool(v bool) OptBool

NewOptBool returns new OptBool with value set to v.

func (OptBool) Get

func (o OptBool) Get() (v bool, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptBool) IsSet

func (o OptBool) IsSet() bool

IsSet returns true if OptBool was set.

func (OptBool) Or

func (o OptBool) Or(d bool) bool

Or returns value if set, or given parameter if does not.

func (*OptBool) Reset

func (o *OptBool) Reset()

Reset unsets value.

func (*OptBool) SetTo

func (o *OptBool) SetTo(v bool)

SetTo sets value to v.

type OptChatCompletionResponseMessage

type OptChatCompletionResponseMessage struct {
	Value ChatCompletionResponseMessage
	Set   bool
}

OptChatCompletionResponseMessage is optional ChatCompletionResponseMessage.

func NewOptChatCompletionResponseMessage

func NewOptChatCompletionResponseMessage(v ChatCompletionResponseMessage) OptChatCompletionResponseMessage

NewOptChatCompletionResponseMessage returns new OptChatCompletionResponseMessage with value set to v.

func (*OptChatCompletionResponseMessage) Decode

Decode decodes ChatCompletionResponseMessage from json.

func (OptChatCompletionResponseMessage) Encode

Encode encodes ChatCompletionResponseMessage as json.

func (OptChatCompletionResponseMessage) Get

Get returns value and boolean that denotes whether value was set.

func (OptChatCompletionResponseMessage) IsSet

IsSet returns true if OptChatCompletionResponseMessage was set.

func (OptChatCompletionResponseMessage) MarshalJSON

func (s OptChatCompletionResponseMessage) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptChatCompletionResponseMessage) Or

Or returns value if set, or given parameter if does not.

func (*OptChatCompletionResponseMessage) Reset

Reset unsets value.

func (*OptChatCompletionResponseMessage) SetTo

SetTo sets value to v.

func (*OptChatCompletionResponseMessage) UnmarshalJSON

func (s *OptChatCompletionResponseMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptCreateChatCompletionRequestLogitBias

type OptCreateChatCompletionRequestLogitBias struct {
	Value *CreateChatCompletionRequestLogitBias
	Set   bool
}

OptCreateChatCompletionRequestLogitBias is optional *CreateChatCompletionRequestLogitBias.

func NewOptCreateChatCompletionRequestLogitBias

func NewOptCreateChatCompletionRequestLogitBias(v *CreateChatCompletionRequestLogitBias) OptCreateChatCompletionRequestLogitBias

NewOptCreateChatCompletionRequestLogitBias returns new OptCreateChatCompletionRequestLogitBias with value set to v.

func (*OptCreateChatCompletionRequestLogitBias) Decode

Decode decodes *CreateChatCompletionRequestLogitBias from json.

func (OptCreateChatCompletionRequestLogitBias) Encode

Encode encodes *CreateChatCompletionRequestLogitBias as json.

func (OptCreateChatCompletionRequestLogitBias) Get

Get returns value and boolean that denotes whether value was set.

func (OptCreateChatCompletionRequestLogitBias) IsSet

IsSet returns true if OptCreateChatCompletionRequestLogitBias was set.

func (OptCreateChatCompletionRequestLogitBias) MarshalJSON

func (s OptCreateChatCompletionRequestLogitBias) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptCreateChatCompletionRequestLogitBias) Or

Or returns value if set, or given parameter if does not.

func (*OptCreateChatCompletionRequestLogitBias) Reset

Reset unsets value.

func (*OptCreateChatCompletionRequestLogitBias) SetTo

SetTo sets value to v.

func (*OptCreateChatCompletionRequestLogitBias) UnmarshalJSON

func (s *OptCreateChatCompletionRequestLogitBias) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptCreateChatCompletionRequestStop

type OptCreateChatCompletionRequestStop struct {
	Value CreateChatCompletionRequestStop
	Set   bool
}

OptCreateChatCompletionRequestStop is optional CreateChatCompletionRequestStop.

func NewOptCreateChatCompletionRequestStop

func NewOptCreateChatCompletionRequestStop(v CreateChatCompletionRequestStop) OptCreateChatCompletionRequestStop

NewOptCreateChatCompletionRequestStop returns new OptCreateChatCompletionRequestStop with value set to v.

func (*OptCreateChatCompletionRequestStop) Decode

Decode decodes CreateChatCompletionRequestStop from json.

func (OptCreateChatCompletionRequestStop) Encode

Encode encodes CreateChatCompletionRequestStop as json.

func (OptCreateChatCompletionRequestStop) Get

Get returns value and boolean that denotes whether value was set.

func (OptCreateChatCompletionRequestStop) IsSet

IsSet returns true if OptCreateChatCompletionRequestStop was set.

func (OptCreateChatCompletionRequestStop) MarshalJSON

func (s OptCreateChatCompletionRequestStop) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptCreateChatCompletionRequestStop) Or

Or returns value if set, or given parameter if does not.

func (*OptCreateChatCompletionRequestStop) Reset

Reset unsets value.

func (*OptCreateChatCompletionRequestStop) SetTo

SetTo sets value to v.

func (*OptCreateChatCompletionRequestStop) UnmarshalJSON

func (s *OptCreateChatCompletionRequestStop) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptCreateChatCompletionResponseUsage

type OptCreateChatCompletionResponseUsage struct {
	Value CreateChatCompletionResponseUsage
	Set   bool
}

OptCreateChatCompletionResponseUsage is optional CreateChatCompletionResponseUsage.

func NewOptCreateChatCompletionResponseUsage

func NewOptCreateChatCompletionResponseUsage(v CreateChatCompletionResponseUsage) OptCreateChatCompletionResponseUsage

NewOptCreateChatCompletionResponseUsage returns new OptCreateChatCompletionResponseUsage with value set to v.

func (*OptCreateChatCompletionResponseUsage) Decode

Decode decodes CreateChatCompletionResponseUsage from json.

func (OptCreateChatCompletionResponseUsage) Encode

Encode encodes CreateChatCompletionResponseUsage as json.

func (OptCreateChatCompletionResponseUsage) Get

Get returns value and boolean that denotes whether value was set.

func (OptCreateChatCompletionResponseUsage) IsSet

IsSet returns true if OptCreateChatCompletionResponseUsage was set.

func (OptCreateChatCompletionResponseUsage) MarshalJSON

func (s OptCreateChatCompletionResponseUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptCreateChatCompletionResponseUsage) Or

Or returns value if set, or given parameter if does not.

func (*OptCreateChatCompletionResponseUsage) Reset

Reset unsets value.

func (*OptCreateChatCompletionResponseUsage) SetTo

SetTo sets value to v.

func (*OptCreateChatCompletionResponseUsage) UnmarshalJSON

func (s *OptCreateChatCompletionResponseUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt

type OptInt struct {
	Value int
	Set   bool
}

OptInt is optional int.

func NewOptInt

func NewOptInt(v int) OptInt

NewOptInt returns new OptInt with value set to v.

func (*OptInt) Decode

func (o *OptInt) Decode(d *jx.Decoder) error

Decode decodes int from json.

func (OptInt) Encode

func (o OptInt) Encode(e *jx.Encoder)

Encode encodes int as json.

func (OptInt) Get

func (o OptInt) Get() (v int, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptInt) IsSet

func (o OptInt) IsSet() bool

IsSet returns true if OptInt was set.

func (OptInt) MarshalJSON

func (s OptInt) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptInt) Or

func (o OptInt) Or(d int) int

Or returns value if set, or given parameter if does not.

func (*OptInt) Reset

func (o *OptInt) Reset()

Reset unsets value.

func (*OptInt) SetTo

func (o *OptInt) SetTo(v int)

SetTo sets value to v.

func (*OptInt) UnmarshalJSON

func (s *OptInt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptMultipartFile

type OptMultipartFile struct {
	Value ht.MultipartFile
	Set   bool
}

OptMultipartFile is optional ht.MultipartFile.

func NewOptMultipartFile

func NewOptMultipartFile(v ht.MultipartFile) OptMultipartFile

NewOptMultipartFile returns new OptMultipartFile with value set to v.

func (OptMultipartFile) Get

func (o OptMultipartFile) Get() (v ht.MultipartFile, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptMultipartFile) IsSet

func (o OptMultipartFile) IsSet() bool

IsSet returns true if OptMultipartFile was set.

func (OptMultipartFile) Or

Or returns value if set, or given parameter if does not.

func (*OptMultipartFile) Reset

func (o *OptMultipartFile) Reset()

Reset unsets value.

func (*OptMultipartFile) SetTo

func (o *OptMultipartFile) SetTo(v ht.MultipartFile)

SetTo sets value to v.

type OptNilBool

type OptNilBool struct {
	Value bool
	Set   bool
	Null  bool
}

OptNilBool is optional nullable bool.

func NewOptNilBool

func NewOptNilBool(v bool) OptNilBool

NewOptNilBool returns new OptNilBool with value set to v.

func (*OptNilBool) Decode

func (o *OptNilBool) Decode(d *jx.Decoder) error

Decode decodes bool from json.

func (OptNilBool) Encode

func (o OptNilBool) Encode(e *jx.Encoder)

Encode encodes bool as json.

func (OptNilBool) Get

func (o OptNilBool) Get() (v bool, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilBool) IsNull

func (o OptNilBool) IsNull() bool

IsSet returns true if value is Null.

func (OptNilBool) IsSet

func (o OptNilBool) IsSet() bool

IsSet returns true if OptNilBool was set.

func (OptNilBool) MarshalJSON

func (s OptNilBool) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilBool) Or

func (o OptNilBool) Or(d bool) bool

Or returns value if set, or given parameter if does not.

func (*OptNilBool) Reset

func (o *OptNilBool) Reset()

Reset unsets value.

func (*OptNilBool) SetTo

func (o *OptNilBool) SetTo(v bool)

SetTo sets value to v.

func (*OptNilBool) SetToNull

func (o *OptNilBool) SetToNull()

SetNull sets value to null.

func (*OptNilBool) UnmarshalJSON

func (s *OptNilBool) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilCreateEditResponseChoicesItemLogprobs

type OptNilCreateEditResponseChoicesItemLogprobs struct {
	Value CreateEditResponseChoicesItemLogprobs
	Set   bool
	Null  bool
}

OptNilCreateEditResponseChoicesItemLogprobs is optional nullable CreateEditResponseChoicesItemLogprobs.

func NewOptNilCreateEditResponseChoicesItemLogprobs

func NewOptNilCreateEditResponseChoicesItemLogprobs(v CreateEditResponseChoicesItemLogprobs) OptNilCreateEditResponseChoicesItemLogprobs

NewOptNilCreateEditResponseChoicesItemLogprobs returns new OptNilCreateEditResponseChoicesItemLogprobs with value set to v.

func (*OptNilCreateEditResponseChoicesItemLogprobs) Decode

Decode decodes CreateEditResponseChoicesItemLogprobs from json.

func (OptNilCreateEditResponseChoicesItemLogprobs) Encode

Encode encodes CreateEditResponseChoicesItemLogprobs as json.

func (OptNilCreateEditResponseChoicesItemLogprobs) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateEditResponseChoicesItemLogprobs) IsNull

IsSet returns true if value is Null.

func (OptNilCreateEditResponseChoicesItemLogprobs) IsSet

IsSet returns true if OptNilCreateEditResponseChoicesItemLogprobs was set.

func (OptNilCreateEditResponseChoicesItemLogprobs) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (OptNilCreateEditResponseChoicesItemLogprobs) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateEditResponseChoicesItemLogprobs) Reset

Reset unsets value.

func (*OptNilCreateEditResponseChoicesItemLogprobs) SetTo

SetTo sets value to v.

func (*OptNilCreateEditResponseChoicesItemLogprobs) SetToNull

SetNull sets value to null.

func (*OptNilCreateEditResponseChoicesItemLogprobs) UnmarshalJSON

func (s *OptNilCreateEditResponseChoicesItemLogprobs) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilCreateImageEditRequestResponseFormat

type OptNilCreateImageEditRequestResponseFormat struct {
	Value CreateImageEditRequestResponseFormat
	Set   bool
	Null  bool
}

OptNilCreateImageEditRequestResponseFormat is optional nullable CreateImageEditRequestResponseFormat.

func NewOptNilCreateImageEditRequestResponseFormat

func NewOptNilCreateImageEditRequestResponseFormat(v CreateImageEditRequestResponseFormat) OptNilCreateImageEditRequestResponseFormat

NewOptNilCreateImageEditRequestResponseFormat returns new OptNilCreateImageEditRequestResponseFormat with value set to v.

func (OptNilCreateImageEditRequestResponseFormat) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateImageEditRequestResponseFormat) IsNull

IsSet returns true if value is Null.

func (OptNilCreateImageEditRequestResponseFormat) IsSet

IsSet returns true if OptNilCreateImageEditRequestResponseFormat was set.

func (OptNilCreateImageEditRequestResponseFormat) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateImageEditRequestResponseFormat) Reset

Reset unsets value.

func (*OptNilCreateImageEditRequestResponseFormat) SetTo

SetTo sets value to v.

func (*OptNilCreateImageEditRequestResponseFormat) SetToNull

SetNull sets value to null.

type OptNilCreateImageEditRequestSize

type OptNilCreateImageEditRequestSize struct {
	Value CreateImageEditRequestSize
	Set   bool
	Null  bool
}

OptNilCreateImageEditRequestSize is optional nullable CreateImageEditRequestSize.

func NewOptNilCreateImageEditRequestSize

func NewOptNilCreateImageEditRequestSize(v CreateImageEditRequestSize) OptNilCreateImageEditRequestSize

NewOptNilCreateImageEditRequestSize returns new OptNilCreateImageEditRequestSize with value set to v.

func (OptNilCreateImageEditRequestSize) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateImageEditRequestSize) IsNull

IsSet returns true if value is Null.

func (OptNilCreateImageEditRequestSize) IsSet

IsSet returns true if OptNilCreateImageEditRequestSize was set.

func (OptNilCreateImageEditRequestSize) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateImageEditRequestSize) Reset

Reset unsets value.

func (*OptNilCreateImageEditRequestSize) SetTo

SetTo sets value to v.

func (*OptNilCreateImageEditRequestSize) SetToNull

func (o *OptNilCreateImageEditRequestSize) SetToNull()

SetNull sets value to null.

type OptNilCreateImageRequestResponseFormat

type OptNilCreateImageRequestResponseFormat struct {
	Value CreateImageRequestResponseFormat
	Set   bool
	Null  bool
}

OptNilCreateImageRequestResponseFormat is optional nullable CreateImageRequestResponseFormat.

func NewOptNilCreateImageRequestResponseFormat

func NewOptNilCreateImageRequestResponseFormat(v CreateImageRequestResponseFormat) OptNilCreateImageRequestResponseFormat

NewOptNilCreateImageRequestResponseFormat returns new OptNilCreateImageRequestResponseFormat with value set to v.

func (*OptNilCreateImageRequestResponseFormat) Decode

Decode decodes CreateImageRequestResponseFormat from json.

func (OptNilCreateImageRequestResponseFormat) Encode

Encode encodes CreateImageRequestResponseFormat as json.

func (OptNilCreateImageRequestResponseFormat) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateImageRequestResponseFormat) IsNull

IsSet returns true if value is Null.

func (OptNilCreateImageRequestResponseFormat) IsSet

IsSet returns true if OptNilCreateImageRequestResponseFormat was set.

func (OptNilCreateImageRequestResponseFormat) MarshalJSON

func (s OptNilCreateImageRequestResponseFormat) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilCreateImageRequestResponseFormat) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateImageRequestResponseFormat) Reset

Reset unsets value.

func (*OptNilCreateImageRequestResponseFormat) SetTo

SetTo sets value to v.

func (*OptNilCreateImageRequestResponseFormat) SetToNull

SetNull sets value to null.

func (*OptNilCreateImageRequestResponseFormat) UnmarshalJSON

func (s *OptNilCreateImageRequestResponseFormat) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilCreateImageRequestSize

type OptNilCreateImageRequestSize struct {
	Value CreateImageRequestSize
	Set   bool
	Null  bool
}

OptNilCreateImageRequestSize is optional nullable CreateImageRequestSize.

func NewOptNilCreateImageRequestSize

func NewOptNilCreateImageRequestSize(v CreateImageRequestSize) OptNilCreateImageRequestSize

NewOptNilCreateImageRequestSize returns new OptNilCreateImageRequestSize with value set to v.

func (*OptNilCreateImageRequestSize) Decode

Decode decodes CreateImageRequestSize from json.

func (OptNilCreateImageRequestSize) Encode

Encode encodes CreateImageRequestSize as json.

func (OptNilCreateImageRequestSize) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateImageRequestSize) IsNull

IsSet returns true if value is Null.

func (OptNilCreateImageRequestSize) IsSet

IsSet returns true if OptNilCreateImageRequestSize was set.

func (OptNilCreateImageRequestSize) MarshalJSON

func (s OptNilCreateImageRequestSize) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilCreateImageRequestSize) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateImageRequestSize) Reset

func (o *OptNilCreateImageRequestSize) Reset()

Reset unsets value.

func (*OptNilCreateImageRequestSize) SetTo

SetTo sets value to v.

func (*OptNilCreateImageRequestSize) SetToNull

func (o *OptNilCreateImageRequestSize) SetToNull()

SetNull sets value to null.

func (*OptNilCreateImageRequestSize) UnmarshalJSON

func (s *OptNilCreateImageRequestSize) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilCreateImageVariationRequestResponseFormat

type OptNilCreateImageVariationRequestResponseFormat struct {
	Value CreateImageVariationRequestResponseFormat
	Set   bool
	Null  bool
}

OptNilCreateImageVariationRequestResponseFormat is optional nullable CreateImageVariationRequestResponseFormat.

func NewOptNilCreateImageVariationRequestResponseFormat

func NewOptNilCreateImageVariationRequestResponseFormat(v CreateImageVariationRequestResponseFormat) OptNilCreateImageVariationRequestResponseFormat

NewOptNilCreateImageVariationRequestResponseFormat returns new OptNilCreateImageVariationRequestResponseFormat with value set to v.

func (OptNilCreateImageVariationRequestResponseFormat) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateImageVariationRequestResponseFormat) IsNull

IsSet returns true if value is Null.

func (OptNilCreateImageVariationRequestResponseFormat) IsSet

IsSet returns true if OptNilCreateImageVariationRequestResponseFormat was set.

func (OptNilCreateImageVariationRequestResponseFormat) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateImageVariationRequestResponseFormat) Reset

Reset unsets value.

func (*OptNilCreateImageVariationRequestResponseFormat) SetTo

SetTo sets value to v.

func (*OptNilCreateImageVariationRequestResponseFormat) SetToNull

SetNull sets value to null.

type OptNilCreateImageVariationRequestSize

type OptNilCreateImageVariationRequestSize struct {
	Value CreateImageVariationRequestSize
	Set   bool
	Null  bool
}

OptNilCreateImageVariationRequestSize is optional nullable CreateImageVariationRequestSize.

func NewOptNilCreateImageVariationRequestSize

func NewOptNilCreateImageVariationRequestSize(v CreateImageVariationRequestSize) OptNilCreateImageVariationRequestSize

NewOptNilCreateImageVariationRequestSize returns new OptNilCreateImageVariationRequestSize with value set to v.

func (OptNilCreateImageVariationRequestSize) Get

Get returns value and boolean that denotes whether value was set.

func (OptNilCreateImageVariationRequestSize) IsNull

IsSet returns true if value is Null.

func (OptNilCreateImageVariationRequestSize) IsSet

IsSet returns true if OptNilCreateImageVariationRequestSize was set.

func (OptNilCreateImageVariationRequestSize) Or

Or returns value if set, or given parameter if does not.

func (*OptNilCreateImageVariationRequestSize) Reset

Reset unsets value.

func (*OptNilCreateImageVariationRequestSize) SetTo

SetTo sets value to v.

func (*OptNilCreateImageVariationRequestSize) SetToNull

SetNull sets value to null.

type OptNilFloat64

type OptNilFloat64 struct {
	Value float64
	Set   bool
	Null  bool
}

OptNilFloat64 is optional nullable float64.

func NewOptNilFloat64

func NewOptNilFloat64(v float64) OptNilFloat64

NewOptNilFloat64 returns new OptNilFloat64 with value set to v.

func (*OptNilFloat64) Decode

func (o *OptNilFloat64) Decode(d *jx.Decoder) error

Decode decodes float64 from json.

func (OptNilFloat64) Encode

func (o OptNilFloat64) Encode(e *jx.Encoder)

Encode encodes float64 as json.

func (OptNilFloat64) Get

func (o OptNilFloat64) Get() (v float64, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilFloat64) IsNull

func (o OptNilFloat64) IsNull() bool

IsSet returns true if value is Null.

func (OptNilFloat64) IsSet

func (o OptNilFloat64) IsSet() bool

IsSet returns true if OptNilFloat64 was set.

func (OptNilFloat64) MarshalJSON

func (s OptNilFloat64) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilFloat64) Or

func (o OptNilFloat64) Or(d float64) float64

Or returns value if set, or given parameter if does not.

func (*OptNilFloat64) Reset

func (o *OptNilFloat64) Reset()

Reset unsets value.

func (*OptNilFloat64) SetTo

func (o *OptNilFloat64) SetTo(v float64)

SetTo sets value to v.

func (*OptNilFloat64) SetToNull

func (o *OptNilFloat64) SetToNull()

SetNull sets value to null.

func (*OptNilFloat64) UnmarshalJSON

func (s *OptNilFloat64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilFloat64Array

type OptNilFloat64Array struct {
	Value []float64
	Set   bool
	Null  bool
}

OptNilFloat64Array is optional nullable []float64.

func NewOptNilFloat64Array

func NewOptNilFloat64Array(v []float64) OptNilFloat64Array

NewOptNilFloat64Array returns new OptNilFloat64Array with value set to v.

func (*OptNilFloat64Array) Decode

func (o *OptNilFloat64Array) Decode(d *jx.Decoder) error

Decode decodes []float64 from json.

func (OptNilFloat64Array) Encode

func (o OptNilFloat64Array) Encode(e *jx.Encoder)

Encode encodes []float64 as json.

func (OptNilFloat64Array) Get

func (o OptNilFloat64Array) Get() (v []float64, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilFloat64Array) IsNull

func (o OptNilFloat64Array) IsNull() bool

IsSet returns true if value is Null.

func (OptNilFloat64Array) IsSet

func (o OptNilFloat64Array) IsSet() bool

IsSet returns true if OptNilFloat64Array was set.

func (OptNilFloat64Array) MarshalJSON

func (s OptNilFloat64Array) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilFloat64Array) Or

func (o OptNilFloat64Array) Or(d []float64) []float64

Or returns value if set, or given parameter if does not.

func (*OptNilFloat64Array) Reset

func (o *OptNilFloat64Array) Reset()

Reset unsets value.

func (*OptNilFloat64Array) SetTo

func (o *OptNilFloat64Array) SetTo(v []float64)

SetTo sets value to v.

func (*OptNilFloat64Array) SetToNull

func (o *OptNilFloat64Array) SetToNull()

SetNull sets value to null.

func (*OptNilFloat64Array) UnmarshalJSON

func (s *OptNilFloat64Array) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilInt

type OptNilInt struct {
	Value int
	Set   bool
	Null  bool
}

OptNilInt is optional nullable int.

func NewOptNilInt

func NewOptNilInt(v int) OptNilInt

NewOptNilInt returns new OptNilInt with value set to v.

func (*OptNilInt) Decode

func (o *OptNilInt) Decode(d *jx.Decoder) error

Decode decodes int from json.

func (OptNilInt) Encode

func (o OptNilInt) Encode(e *jx.Encoder)

Encode encodes int as json.

func (OptNilInt) Get

func (o OptNilInt) Get() (v int, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilInt) IsNull

func (o OptNilInt) IsNull() bool

IsSet returns true if value is Null.

func (OptNilInt) IsSet

func (o OptNilInt) IsSet() bool

IsSet returns true if OptNilInt was set.

func (OptNilInt) MarshalJSON

func (s OptNilInt) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilInt) Or

func (o OptNilInt) Or(d int) int

Or returns value if set, or given parameter if does not.

func (*OptNilInt) Reset

func (o *OptNilInt) Reset()

Reset unsets value.

func (*OptNilInt) SetTo

func (o *OptNilInt) SetTo(v int)

SetTo sets value to v.

func (*OptNilInt) SetToNull

func (o *OptNilInt) SetToNull()

SetNull sets value to null.

func (*OptNilInt) UnmarshalJSON

func (s *OptNilInt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilString

type OptNilString struct {
	Value string
	Set   bool
	Null  bool
}

OptNilString is optional nullable string.

func NewOptNilString

func NewOptNilString(v string) OptNilString

NewOptNilString returns new OptNilString with value set to v.

func (*OptNilString) Decode

func (o *OptNilString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptNilString) Encode

func (o OptNilString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptNilString) Get

func (o OptNilString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilString) IsNull

func (o OptNilString) IsNull() bool

IsSet returns true if value is Null.

func (OptNilString) IsSet

func (o OptNilString) IsSet() bool

IsSet returns true if OptNilString was set.

func (OptNilString) MarshalJSON

func (s OptNilString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilString) Or

func (o OptNilString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptNilString) Reset

func (o *OptNilString) Reset()

Reset unsets value.

func (*OptNilString) SetTo

func (o *OptNilString) SetTo(v string)

SetTo sets value to v.

func (*OptNilString) SetToNull

func (o *OptNilString) SetToNull()

SetNull sets value to null.

func (*OptNilString) UnmarshalJSON

func (s *OptNilString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the metric.NewNoopMeterProvider is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type RetrieveFileParams

type RetrieveFileParams struct {
	// The ID of the file to use for this request.
	FileID string
}

RetrieveFileParams is parameters of retrieveFile operation.

type RetrieveFineTuneParams

type RetrieveFineTuneParams struct {
	// The ID of the fine-tune job.
	FineTuneID string
}

RetrieveFineTuneParams is parameters of retrieveFineTune operation.

type RetrieveModelParams

type RetrieveModelParams struct {
	// The ID of the model to use for this request.
	Model string
}

RetrieveModelParams is parameters of retrieveModel operation.

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) CancelFineTune

func (UnimplementedHandler) CancelFineTune(ctx context.Context, params CancelFineTuneParams) (r FineTune, _ error)

CancelFineTune implements cancelFineTune operation.

Immediately cancel a fine-tune job.

POST /fine-tunes/{fine_tune_id}/cancel

func (UnimplementedHandler) CreateChatCompletion

CreateChatCompletion implements createChatCompletion operation.

Creates a completion for the chat message.

POST /chat/completions

func (UnimplementedHandler) CreateEdit

CreateEdit implements createEdit operation.

Creates a new edit for the provided input, instruction, and parameters.

POST /edits

func (UnimplementedHandler) CreateFineTune

func (UnimplementedHandler) CreateFineTune(ctx context.Context, req *CreateFineTuneRequest) (r FineTune, _ error)

CreateFineTune implements createFineTune operation.

Creates a job that fine-tunes a specified 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](/docs/guides/fine-tuning).

POST /fine-tunes

func (UnimplementedHandler) CreateImage

CreateImage implements createImage operation.

Creates an image given a prompt.

POST /images/generations

func (UnimplementedHandler) CreateImageEdit

CreateImageEdit implements createImageEdit operation.

Creates an edited or extended image given an original image and a prompt.

POST /images/edits

func (UnimplementedHandler) CreateImageVariation

CreateImageVariation implements createImageVariation operation.

Creates a variation of a given image.

POST /images/variations

func (UnimplementedHandler) CreateModeration

CreateModeration implements createModeration operation.

Classifies if text violates OpenAI's Content Policy.

POST /moderations

func (UnimplementedHandler) DeleteFile

DeleteFile implements deleteFile operation.

Delete a file.

DELETE /files/{file_id}

func (UnimplementedHandler) DeleteModel

DeleteModel implements deleteModel operation.

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

DELETE /models/{model}

func (UnimplementedHandler) DownloadFile

func (UnimplementedHandler) DownloadFile(ctx context.Context, params DownloadFileParams) (r string, _ error)

DownloadFile implements downloadFile operation.

Returns the contents of the specified file.

GET /files/{file_id}/content

func (UnimplementedHandler) ListFiles

ListFiles implements listFiles operation.

Returns a list of files that belong to the user's organization.

GET /files

func (UnimplementedHandler) ListFineTuneEvents

ListFineTuneEvents implements listFineTuneEvents operation.

Get fine-grained status updates for a fine-tune job.

GET /fine-tunes/{fine_tune_id}/events

func (UnimplementedHandler) ListFineTunes

func (UnimplementedHandler) ListFineTunes(ctx context.Context) (r *ListFineTunesResponse, _ error)

ListFineTunes implements listFineTunes operation.

List your organization's fine-tuning jobs.

GET /fine-tunes

func (UnimplementedHandler) ListModels

ListModels implements listModels operation.

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

GET /models

func (UnimplementedHandler) RetrieveFile

func (UnimplementedHandler) RetrieveFile(ctx context.Context, params RetrieveFileParams) (r OpenAIFile, _ error)

RetrieveFile implements retrieveFile operation.

Returns information about a specific file.

GET /files/{file_id}

func (UnimplementedHandler) RetrieveFineTune

func (UnimplementedHandler) RetrieveFineTune(ctx context.Context, params RetrieveFineTuneParams) (r FineTune, _ error)

RetrieveFineTune implements retrieveFineTune operation.

Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning).

GET /fine-tunes/{fine_tune_id}

func (UnimplementedHandler) RetrieveModel

func (UnimplementedHandler) RetrieveModel(ctx context.Context, params RetrieveModelParams) (r Model, _ error)

RetrieveModel implements retrieveModel operation.

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

GET /models/{model}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL