Versions in this module Expand all Collapse all v1 v1.0.0 Apr 1, 2023 Changes in this version + const ChatMessageRoleAssistant + const ChatMessageRoleSystem + const ChatMessageRoleUser + const CodexCodeCushman001 + const CodexCodeDavinci001 + const CodexCodeDavinci002 + const CreateImageResponseFormatB64JSON + const CreateImageResponseFormatURL + const CreateImageSize1024x1024 + const CreateImageSize256x256 + const CreateImageSize512x512 + const GPT3Ada + const GPT3Babbage + const GPT3Curie + const GPT3CurieInstructBeta + const GPT3Davinci + const GPT3DavinciInstructBeta + const GPT3Dot5Turbo + const GPT3Dot5Turbo0301 + const GPT3TextAda001 + const GPT3TextBabbage001 + const GPT3TextCurie001 + const GPT3TextDavinci001 + const GPT3TextDavinci002 + const GPT3TextDavinci003 + const GPT4 + const GPT40314 + const GPT432K + const GPT432K0314 + const Whisper1 + var ErrChatCompletionInvalidModel = errors.New(...) + var ErrChatCompletionStreamNotSupported = errors.New(...) + var ErrCompletionStreamNotSupported = errors.New(...) + var ErrCompletionUnsupportedModel = errors.New(...) + var ErrTooManyEmptyStreamMessages = errors.New("stream has sent too many empty messages") + type APIError struct + Code *string + Message string + Param *string + StatusCode int + Type string + func (e *APIError) Error() string + type AudioRequest struct + FilePath string + Language string + Model string + Prompt string + Temperature float32 + type AudioResponse struct + Text string + type ChatCompletionChoice struct + FinishReason string + Index int + Message ChatCompletionMessage + type ChatCompletionMessage struct + Content string + Name string + Role string + type ChatCompletionRequest struct + FrequencyPenalty float32 + LogitBias map[string]int + MaxTokens int + Messages []ChatCompletionMessage + Model string + N int + PresencePenalty float32 + Stop []string + Stream bool + Temperature float32 + TopP float32 + User string + type ChatCompletionResponse struct + Choices []ChatCompletionChoice + Created int64 + ID string + Model string + Object string + Usage Usage + type ChatCompletionStream struct + func (stream ChatCompletionStream) Close() + func (stream ChatCompletionStream) Recv() (response T, err error) + type ChatCompletionStreamChoice struct + Delta ChatCompletionStreamChoiceDelta + FinishReason string + Index int + type ChatCompletionStreamChoiceDelta struct + Content string + type ChatCompletionStreamResponse struct + Choices []ChatCompletionStreamChoice + Created int64 + ID string + Model string + Object string + type Client struct + func NewClient(authToken string, proxyUrl *url.URL) *Client + func NewClientWithConfig(config ClientConfig) *Client + func NewOrgClient(authToken, org string) *Client + func (c *Client) CancelFineTune(ctx context.Context, fineTuneID string) (response FineTune, err error) + func (c *Client) CreateChatCompletion(ctx context.Context, request ChatCompletionRequest) (response ChatCompletionResponse, err error) + func (c *Client) CreateChatCompletionStream(ctx context.Context, request ChatCompletionRequest) (stream *ChatCompletionStream, err error) + func (c *Client) CreateCompletion(ctx context.Context, request CompletionRequest) (response CompletionResponse, err error) + func (c *Client) CreateCompletionStream(ctx context.Context, request CompletionRequest) (stream *CompletionStream, err error) + func (c *Client) CreateEditImage(ctx context.Context, request ImageEditRequest) (response ImageResponse, err error) + func (c *Client) CreateEmbeddings(ctx context.Context, request EmbeddingRequest) (resp EmbeddingResponse, err error) + func (c *Client) CreateFile(ctx context.Context, request FileRequest) (file File, err error) + func (c *Client) CreateFineTune(ctx context.Context, request FineTuneRequest) (response FineTune, err error) + func (c *Client) CreateImage(ctx context.Context, request ImageRequest) (response ImageResponse, err error) + func (c *Client) CreateTranscription(ctx context.Context, request AudioRequest) (response AudioResponse, err error) + func (c *Client) CreateTranslation(ctx context.Context, request AudioRequest) (response AudioResponse, err error) + func (c *Client) CreateVariImage(ctx context.Context, request ImageVariRequest) (response ImageResponse, err error) + func (c *Client) DeleteFile(ctx context.Context, fileID string) (err error) + func (c *Client) DeleteFineTune(ctx context.Context, fineTuneID string) (response FineTuneDeleteResponse, err error) + func (c *Client) Edits(ctx context.Context, request EditsRequest) (response EditsResponse, err error) + func (c *Client) GetEngine(ctx context.Context, engineID string) (engine Engine, err error) + func (c *Client) GetFile(ctx context.Context, fileID string) (file File, err error) + func (c *Client) GetFineTune(ctx context.Context, fineTuneID string) (response FineTune, err error) + func (c *Client) ListEngines(ctx context.Context) (engines EnginesList, err error) + func (c *Client) ListFiles(ctx context.Context) (files FilesList, err error) + func (c *Client) ListFineTuneEvents(ctx context.Context, fineTuneID string) (response FineTuneEventList, err error) + func (c *Client) ListFineTunes(ctx context.Context) (response FineTuneList, err error) + func (c *Client) ListModels(ctx context.Context) (models ModelsList, err error) + func (c *Client) Moderations(ctx context.Context, request ModerationRequest) (response ModerationResponse, err error) + type ClientConfig struct + BaseURL string + EmptyMessagesLimit uint + HTTPClient *http.Client + OrgID string + func DefaultConfig(authToken string, proxyURL *url.URL) ClientConfig + type CompletionChoice struct + FinishReason string + Index int + LogProbs LogprobResult + Text string + type CompletionRequest struct + BestOf int + Echo bool + FrequencyPenalty float32 + LogProbs int + LogitBias map[string]int + MaxTokens int + Model string + N int + PresencePenalty float32 + Prompt string + Stop []string + Stream bool + Suffix string + Temperature float32 + TopP float32 + User string + type CompletionResponse struct + Choices []CompletionChoice + Created int64 + ID string + Model string + Object string + Usage Usage + type CompletionStream struct + func (stream CompletionStream) Close() + func (stream CompletionStream) Recv() (response T, err error) + type EditsChoice struct + Index int + Text string + type EditsRequest struct + Input string + Instruction string + Model *string + N int + Temperature float32 + TopP float32 + type EditsResponse struct + Choices []EditsChoice + Created int64 + Object string + Usage Usage + type Embedding struct + Embedding []float32 + Index int + Object string + type EmbeddingModel int + const AdaCodeSearchCode + const AdaCodeSearchText + const AdaEmbeddingV2 + const AdaSearchDocument + const AdaSearchQuery + const AdaSimilarity + const BabbageCodeSearchCode + const BabbageCodeSearchText + const BabbageSearchDocument + const BabbageSearchQuery + const BabbageSimilarity + const CurieSearchDocument + const CurieSearchQuery + const CurieSimilarity + const DavinciSearchDocument + const DavinciSearchQuery + const DavinciSimilarity + const Unknown + func (e *EmbeddingModel) UnmarshalText(b []byte) error + func (e EmbeddingModel) MarshalText() ([]byte, error) + func (e EmbeddingModel) String() string + type EmbeddingRequest struct + Input []string + Model EmbeddingModel + User string + type EmbeddingResponse struct + Data []Embedding + Model EmbeddingModel + Object string + Usage Usage + type Engine struct + ID string + Object string + Owner string + Ready bool + type EnginesList struct + Engines []Engine + type ErrorResponse struct + Error *APIError + type File struct + Bytes int + CreatedAt int64 + FileName string + ID string + Object string + Owner string + Purpose string + type FileRequest struct + FileName string + FilePath string + Purpose string + type FilesList struct + Files []File + type FineTune struct + CreatedAt int64 + FineTuneEventList []FineTuneEvent + FineTunedModel string + HyperParams FineTuneHyperParams + ID string + Model string + Object string + OrganizationID string + ResultFiles []File + Status string + TrainingFiles []File + UpdatedAt int64 + ValidationFiles []File + type FineTuneDeleteResponse struct + Deleted bool + ID string + Object string + type FineTuneEvent struct + CreatedAt int64 + Level string + Message string + Object string + type FineTuneEventList struct + Data []FineTuneEvent + Object string + type FineTuneHyperParams struct + BatchSize int + Epochs int + LearningRateMultiplier float64 + PromptLossWeight float64 + type FineTuneList struct + Data []FineTune + Object string + type FineTuneRequest struct + BatchSize int + ClassificationBetas []float32 + ClassificationClasses int + ClassificationPositiveClass string + ComputeClassificationMetrics bool + Epochs int + LearningRateMultiplier float32 + Model string + PromptLossRate float32 + Suffix string + TrainingFile string + ValidationFile string + type ImageEditRequest struct + Image *os.File + Mask *os.File + N int + Prompt string + Size string + type ImageRequest struct + N int + Prompt string + ResponseFormat string + Size string + User string + type ImageResponse struct + Created int64 + Data []ImageResponseDataInner + type ImageResponseDataInner struct + B64JSON string + URL string + type ImageVariRequest struct + Image *os.File + N int + Size string + type LogprobResult struct + TextOffset []int + TokenLogprobs []float32 + Tokens []string + TopLogprobs []map[string]float32 + type Model struct + CreatedAt int64 + ID string + Object string + OwnedBy string + Parent string + Permission []Permission + Root string + type ModelsList struct + Models []Model + type ModerationRequest struct + Input string + Model *string + type ModerationResponse struct + ID string + Model string + Results []Result + type Permission struct + AllowCreateEngine bool + AllowFineTuning bool + AllowLogprobs bool + AllowSampling bool + AllowSearchIndices bool + AllowView bool + CreatedAt int64 + Group interface{} + ID string + IsBlocking bool + Object string + Organization string + type RequestError struct + Err error + StatusCode int + func (e *RequestError) Error() string + func (e *RequestError) Unwrap() error + type Result struct + Categories ResultCategories + CategoryScores ResultCategoryScores + Flagged bool + type ResultCategories struct + Hate bool + HateThreatening bool + SelfHarm bool + Sexual bool + SexualMinors bool + Violence bool + ViolenceGraphic bool + type ResultCategoryScores struct + Hate float32 + HateThreatening float32 + SelfHarm float32 + Sexual float32 + SexualMinors float32 + Violence float32 + ViolenceGraphic float32 + type Usage struct + CompletionTokens int + PromptTokens int + TotalTokens int