sdk

package
v2.0.0-...-5a0ceae Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{
	"https://api.openai.com/v1",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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!

func New

func New(opts ...SDKOption) *Oai

New creates a new instance of the SDK with the provided options

type OpenAI

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

The OpenAI REST API

func (*OpenAI) CancelFineTune

CancelFineTune - Immediately cancel a fine-tune job.

func (*OpenAI) CreateChatCompletion

CreateChatCompletion - Creates a model response for the given chat conversation.

func (*OpenAI) CreateCompletion

CreateCompletion - Creates a completion for the provided prompt and parameters.

func (*OpenAI) CreateEdit

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

CreateEmbedding - Creates an embedding vector representing the input text.

func (*OpenAI) CreateFile

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

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

CreateImage - Creates an image given a prompt.

func (*OpenAI) CreateImageEdit

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

func (*OpenAI) CreateImageVariation

CreateImageVariation - Creates a variation of a given image.

func (*OpenAI) CreateModeration

CreateModeration - Classifies if text violates OpenAI's Content Policy

func (*OpenAI) CreateTranscription

CreateTranscription - Transcribes audio into the input language.

func (*OpenAI) CreateTranslation

CreateTranslation - Translates audio into English.

func (*OpenAI) DeleteFile

DeleteFile - Delete a file.

func (*OpenAI) DeleteModel

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

func (*OpenAI) DownloadFile

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

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

RetrieveFile - Returns information about a specific file.

func (*OpenAI) RetrieveFineTune

RetrieveFineTune - Gets info about the fine-tune job.

[Learn more about Fine-tuning](/docs/guides/fine-tuning)

func (*OpenAI) RetrieveModel

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 WithRetryConfig(retryConfig retry.Config) SDKOption

func WithSecurity

func WithSecurity(security shared.Security) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource

func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTimeout

func WithTimeout(timeout time.Duration) SDKOption

WithTimeout Optional request timeout applied to each operation

Directories

Path Synopsis
internal
models

Jump to

Keyboard shortcuts

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