Documentation ¶
Index ¶
- Variables
- func Bool(b bool) *bool
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Int(i int) *int
- func Int64(i int64) *int64
- func String(s string) *string
- type HTTPClient
- type Oai
- type OpenAI
- func (s *OpenAI) CancelFineTune(ctx context.Context, request operations.CancelFineTuneRequest, ...) (*operations.CancelFineTuneResponse, error)
- func (s *OpenAI) CreateChatCompletion(ctx context.Context, request shared.CreateChatCompletionRequest, ...) (*operations.CreateChatCompletionResponse, error)
- func (s *OpenAI) CreateCompletion(ctx context.Context, request shared.CreateCompletionRequest, ...) (*operations.CreateCompletionResponse, error)
- func (s *OpenAI) CreateEdit(ctx context.Context, request shared.CreateEditRequest, ...) (*operations.CreateEditResponse, error)
- func (s *OpenAI) CreateEmbedding(ctx context.Context, request shared.CreateEmbeddingRequest, ...) (*operations.CreateEmbeddingResponse, error)
- func (s *OpenAI) CreateFile(ctx context.Context, request shared.CreateFileRequest, ...) (*operations.CreateFileResponse, error)
- func (s *OpenAI) CreateFineTune(ctx context.Context, request shared.CreateFineTuneRequest, ...) (*operations.CreateFineTuneResponse, error)
- func (s *OpenAI) CreateImage(ctx context.Context, request shared.CreateImageRequest, ...) (*operations.CreateImageResponse, error)
- func (s *OpenAI) CreateImageEdit(ctx context.Context, request shared.CreateImageEditRequest, ...) (*operations.CreateImageEditResponse, error)
- func (s *OpenAI) CreateImageVariation(ctx context.Context, request shared.CreateImageVariationRequest, ...) (*operations.CreateImageVariationResponse, error)
- func (s *OpenAI) CreateModeration(ctx context.Context, request shared.CreateModerationRequest, ...) (*operations.CreateModerationResponse, error)
- func (s *OpenAI) CreateTranscription(ctx context.Context, request shared.CreateTranscriptionRequest, ...) (*operations.CreateTranscriptionResponse, error)
- func (s *OpenAI) CreateTranslation(ctx context.Context, request shared.CreateTranslationRequest, ...) (*operations.CreateTranslationResponse, error)
- func (s *OpenAI) DeleteFile(ctx context.Context, request operations.DeleteFileRequest, ...) (*operations.DeleteFileResponse, error)
- func (s *OpenAI) DeleteModel(ctx context.Context, request operations.DeleteModelRequest, ...) (*operations.DeleteModelResponse, error)
- func (s *OpenAI) DownloadFile(ctx context.Context, request operations.DownloadFileRequest, ...) (*operations.DownloadFileResponse, error)
- func (s *OpenAI) ListFiles(ctx context.Context, opts ...operations.Option) (*operations.ListFilesResponse, error)
- func (s *OpenAI) ListFineTuneEvents(ctx context.Context, request operations.ListFineTuneEventsRequest, ...) (*operations.ListFineTuneEventsResponse, error)
- func (s *OpenAI) ListFineTunes(ctx context.Context, opts ...operations.Option) (*operations.ListFineTunesResponse, error)
- func (s *OpenAI) ListModels(ctx context.Context, opts ...operations.Option) (*operations.ListModelsResponse, error)
- func (s *OpenAI) RetrieveFile(ctx context.Context, request operations.RetrieveFileRequest, ...) (*operations.RetrieveFileResponse, error)
- func (s *OpenAI) RetrieveFineTune(ctx context.Context, request operations.RetrieveFineTuneRequest, ...) (*operations.RetrieveFineTuneResponse, error)
- func (s *OpenAI) RetrieveModel(ctx context.Context, request operations.RetrieveModelRequest, ...) (*operations.RetrieveModelResponse, error)
- type SDKOption
- func WithClient(client HTTPClient) SDKOption
- func WithRetryConfig(retryConfig retry.Config) SDKOption
- func WithSecurity(security shared.Security) SDKOption
- func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption
- func WithServerIndex(serverIndex int) SDKOption
- func WithServerURL(serverURL string) SDKOption
- func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption
- func WithTimeout(timeout time.Duration) SDKOption
Constants ¶
This section is empty.
Variables ¶
var ServerList = []string{
"https://api.openai.com/v1",
}
ServerList contains the list of servers available to the SDK
Functions ¶
Types ¶
type HTTPClient ¶
HTTPClient provides an interface for suplying the SDK with a custom HTTP client
type Oai ¶
type Oai struct { // The OpenAI REST API OpenAI *OpenAI // contains filtered or unexported fields }
Oai - OpenAI API: APIs for sampling from and fine-tuning language models. Hello World!
type OpenAI ¶
type OpenAI struct {
// contains filtered or unexported fields
}
The OpenAI REST API
func (*OpenAI) CancelFineTune ¶
func (s *OpenAI) CancelFineTune(ctx context.Context, request operations.CancelFineTuneRequest, opts ...operations.Option) (*operations.CancelFineTuneResponse, error)
CancelFineTune - Immediately cancel a fine-tune job.
func (*OpenAI) CreateChatCompletion ¶
func (s *OpenAI) CreateChatCompletion(ctx context.Context, request shared.CreateChatCompletionRequest, opts ...operations.Option) (*operations.CreateChatCompletionResponse, error)
CreateChatCompletion - Creates a model response for the given chat conversation.
func (*OpenAI) CreateCompletion ¶
func (s *OpenAI) CreateCompletion(ctx context.Context, request shared.CreateCompletionRequest, opts ...operations.Option) (*operations.CreateCompletionResponse, error)
CreateCompletion - Creates a completion for the provided prompt and parameters.
func (*OpenAI) CreateEdit ¶
func (s *OpenAI) CreateEdit(ctx context.Context, request shared.CreateEditRequest, opts ...operations.Option) (*operations.CreateEditResponse, error)
CreateEdit - Creates a new edit for the provided input, instruction, and parameters.
Deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
func (*OpenAI) CreateEmbedding ¶
func (s *OpenAI) CreateEmbedding(ctx context.Context, request shared.CreateEmbeddingRequest, opts ...operations.Option) (*operations.CreateEmbeddingResponse, error)
CreateEmbedding - Creates an embedding vector representing the input text.
func (*OpenAI) CreateFile ¶
func (s *OpenAI) CreateFile(ctx context.Context, request shared.CreateFileRequest, opts ...operations.Option) (*operations.CreateFileResponse, error)
CreateFile - Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
func (*OpenAI) CreateFineTune ¶
func (s *OpenAI) CreateFineTune(ctx context.Context, request shared.CreateFineTuneRequest, opts ...operations.Option) (*operations.CreateFineTuneResponse, error)
CreateFineTune - 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)
func (*OpenAI) CreateImage ¶
func (s *OpenAI) CreateImage(ctx context.Context, request shared.CreateImageRequest, opts ...operations.Option) (*operations.CreateImageResponse, error)
CreateImage - Creates an image given a prompt.
func (*OpenAI) CreateImageEdit ¶
func (s *OpenAI) CreateImageEdit(ctx context.Context, request shared.CreateImageEditRequest, opts ...operations.Option) (*operations.CreateImageEditResponse, error)
CreateImageEdit - Creates an edited or extended image given an original image and a prompt.
func (*OpenAI) CreateImageVariation ¶
func (s *OpenAI) CreateImageVariation(ctx context.Context, request shared.CreateImageVariationRequest, opts ...operations.Option) (*operations.CreateImageVariationResponse, error)
CreateImageVariation - Creates a variation of a given image.
func (*OpenAI) CreateModeration ¶
func (s *OpenAI) CreateModeration(ctx context.Context, request shared.CreateModerationRequest, opts ...operations.Option) (*operations.CreateModerationResponse, error)
CreateModeration - Classifies if text violates OpenAI's Content Policy
func (*OpenAI) CreateTranscription ¶
func (s *OpenAI) CreateTranscription(ctx context.Context, request shared.CreateTranscriptionRequest, opts ...operations.Option) (*operations.CreateTranscriptionResponse, error)
CreateTranscription - Transcribes audio into the input language.
func (*OpenAI) CreateTranslation ¶
func (s *OpenAI) CreateTranslation(ctx context.Context, request shared.CreateTranslationRequest, opts ...operations.Option) (*operations.CreateTranslationResponse, error)
CreateTranslation - Translates audio into English.
func (*OpenAI) DeleteFile ¶
func (s *OpenAI) DeleteFile(ctx context.Context, request operations.DeleteFileRequest, opts ...operations.Option) (*operations.DeleteFileResponse, error)
DeleteFile - Delete a file.
func (*OpenAI) DeleteModel ¶
func (s *OpenAI) DeleteModel(ctx context.Context, request operations.DeleteModelRequest, opts ...operations.Option) (*operations.DeleteModelResponse, error)
DeleteModel - Delete a fine-tuned model. You must have the Owner role in your organization.
func (*OpenAI) DownloadFile ¶
func (s *OpenAI) DownloadFile(ctx context.Context, request operations.DownloadFileRequest, opts ...operations.Option) (*operations.DownloadFileResponse, error)
DownloadFile - Returns the contents of the specified file
func (*OpenAI) ListFiles ¶
func (s *OpenAI) ListFiles(ctx context.Context, opts ...operations.Option) (*operations.ListFilesResponse, error)
ListFiles - Returns a list of files that belong to the user's organization.
func (*OpenAI) ListFineTuneEvents ¶
func (s *OpenAI) ListFineTuneEvents(ctx context.Context, request operations.ListFineTuneEventsRequest, opts ...operations.Option) (*operations.ListFineTuneEventsResponse, error)
ListFineTuneEvents - Get fine-grained status updates for a fine-tune job.
func (*OpenAI) ListFineTunes ¶
func (s *OpenAI) ListFineTunes(ctx context.Context, opts ...operations.Option) (*operations.ListFineTunesResponse, error)
ListFineTunes - List your organization's fine-tuning jobs
func (*OpenAI) ListModels ¶
func (s *OpenAI) ListModels(ctx context.Context, opts ...operations.Option) (*operations.ListModelsResponse, error)
ListModels - Lists the currently available models, and provides basic information about each one such as the owner and availability.
func (*OpenAI) RetrieveFile ¶
func (s *OpenAI) RetrieveFile(ctx context.Context, request operations.RetrieveFileRequest, opts ...operations.Option) (*operations.RetrieveFileResponse, error)
RetrieveFile - Returns information about a specific file.
func (*OpenAI) RetrieveFineTune ¶
func (s *OpenAI) RetrieveFineTune(ctx context.Context, request operations.RetrieveFineTuneRequest, opts ...operations.Option) (*operations.RetrieveFineTuneResponse, error)
RetrieveFineTune - Gets info about the fine-tune job.
[Learn more about Fine-tuning](/docs/guides/fine-tuning)
func (*OpenAI) RetrieveModel ¶
func (s *OpenAI) RetrieveModel(ctx context.Context, request operations.RetrieveModelRequest, opts ...operations.Option) (*operations.RetrieveModelResponse, error)
RetrieveModel - Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
type SDKOption ¶
type SDKOption func(*Oai)
func WithClient ¶
func WithClient(client HTTPClient) SDKOption
WithClient allows the overriding of the default HTTP client used by the SDK
func WithRetryConfig ¶
func WithSecurity ¶
WithSecurity configures the SDK to use the provided security details
func WithSecuritySource ¶
WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication
func WithServerIndex ¶
WithServerIndex allows the overriding of the default server by index
func WithServerURL ¶
WithServerURL allows the overriding of the default server URL
func WithTemplatedServerURL ¶
WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters
func WithTimeout ¶
WithTimeout Optional request timeout applied to each operation