Versions in this module Expand all Collapse all v1 v1.2.0 Mar 11, 2023 Changes in this version + type ChatCompletion struct + Choices []ChatCompletionChoice + Created int + ID string + Object string + Usage TokenUsage + type ChatCompletionChoice struct + FinishReason string + Index int + Message ChatCompletionMessage + type ChatCompletionMessage struct + Content string + Role ChatCompletionMessageRole + type ChatCompletionMessageRole string + const ChatCompletionMessageRoleAssistant + const ChatCompletionMessageRoleSystem + const ChatCompletionMessageRoleUser + type ChatCompletionParams struct + FrequencyPenalty float64 + LogitBias LogitBias + Messages []ChatCompletionMessage + Model string + N int + PresencePenalty float64 + Stop string + Temperature float64 + TopP float64 + User string + type ChatCompletionsAPI interface + Create func(ChatCompletionParams) (ChatCompletion, error) type Client + ChatCompletions func() ChatCompletionsAPI + type LogitBias map[string]interface v1.1.0 Feb 9, 2023 v1.0.0 Feb 9, 2023 Changes in this version + var ErrRequestTimeout = errors.New("request timeout") + type Client interface + Completions func() CompletionsAPI + Edits func() EditsAPI + Embeddings func() EmbeddingsAPI + Files func() FilesAPI + FineTunes func() FineTunesAPI + Images func() ImagesAPI + Models func() ModelsAPI + Moderations func() ModerationsAPI + func New(cfg Config) Client + type Completion struct + Choices []CompletionChoice + Created int + ID string + Model string + Usage TokenUsage + type CompletionChoice struct + FinishReason string + Index int + Logprobs LogProbabilities + Text string + type CompletionParams struct + BestOf int + Echo bool + FrequencyPenalty float64 + Logprobs int + MaxTokens int + Model string + N int + PresencePenalty float64 + Prompt string + Stop string + Suffix string + Temperature float64 + TopP float64 + User string + type CompletionsAPI interface + Create func(CompletionParams) (Completion, error) + type Config struct + APIKey string + OrganizationID string + RequestTimeout time.Duration + type DeletedFile struct + Deleted bool + ID string + type DeletedModel struct + Deleted bool + ID string + type Edit struct + Choices []EditChoice + Created int + Usage TokenUsage + type EditChoice struct + Index int + Text string + type EditParams struct + Input string + Instruction string + Model string + N int + Temperature float64 + TopP float64 + type EditsAPI interface + Create func(EditParams) (Edit, error) + type Embedding struct + Embedding []float64 + Model string + Usage TokenUsage + type EmbeddingParams struct + Input string + Model string + User string + type EmbeddingsAPI interface + Create func(EmbeddingParams) (Embedding, error) + type File struct + Bytes int + CreatedAt int + Filename string + ID string + Purpose string + type FileParams struct + File string + Purpose string + type FilesAPI interface + Create func(FileParams) (File, error) + DeleteByID func(id string) (DeletedFile, error) + DownloadByID func(id string, dst io.Writer) error + GetAll func() ([]File, error) + GetByID func(id string) (File, error) + type FineTune struct + CreatedAt int + Events []FineTuneEvent + FineTunedModel string + Hyperparams FineTuneHyperparams + ID string + Model string + OrganizationID string + ResultFiles []File + Status string + TrainingFiles []File + UpdatedAt int + ValidationFiles []interface{} + type FineTuneEvent struct + CreatedAt int + Level string + Message string + type FineTuneHyperparams struct + BatchSize int + LearningRateMultiplier float64 + NEpochs int + PromptLossWeight float64 + type FineTuneParams struct + BatchSize int + ClassificationBetas []interface{} + ClassificationNClasses int + ClassificationPositiveClass string + ComputeClassificationMetrics bool + LearningRateMultiplier float64 + Model string + NEpochs int + PromptLossWeight float64 + Suffix string + TrainingFile string + ValidationFile string + type FineTunesAPI interface + Cancel func(id string) (FineTune, error) + Create func(FineTuneParams) (FineTune, error) + GetAll func() ([]FineTune, error) + GetByID func(id string) (FineTune, error) + GetEvents func(fineTuneID string) ([]FineTuneEvent, error) + type Image struct + B64JSON string + URL string + type ImageEditParams struct + Image string + Mask string + N uint + Prompt string + ResponseFormat ImageResponseFormat + Size ImageSize + User string + type ImageGenerationParams struct + N uint + Prompt string + ResponseFormat ImageResponseFormat + Size ImageSize + User string + type ImageResponseFormat string + const ImageResponseFormatB64JSON + const ImageResponseFormatURL + type ImageSize string + const ImageSize1024x1024 + const ImageSize256x256 + const ImageSize512x512 + type ImageVariationParams struct + Image string + N uint + ResponseFormat ImageResponseFormat + Size ImageSize + User string + type ImagesAPI interface + Create func(ImageGenerationParams) ([]Image, error) + CreateVariations func(ImageVariationParams) ([]Image, error) + Edit func(ImageEditParams) ([]Image, error) + type LogProbabilities struct + TextOffset []int + TokenLogprobs []float64 + Tokens []string + TopLogprobs []map[string]float64 + type Model struct + Created uint + ID string + OwnedBy string + Parent interface{} + Permission []ModelPermission + Root string + type ModelPermission struct + AllowCreateEngine bool + AllowFineTuning bool + AllowLogprobs bool + AllowSampling bool + AllowSearchIndices bool + AllowView bool + Created uint + Group interface{} + ID string + IsBlocking bool + Organization string + type ModelsAPI interface + DeleteByID func(id string) (DeletedModel, error) + GetAll func() ([]Model, error) + GetByID func(id string) (Model, error) + type Moderation struct + ID string + Model string + Results []ModerationResult + type ModerationParams struct + Input string + Model string + type ModerationResult struct + Categories ModerationResultCategories + CategoryScores ModerationResultCategoryScores + Flagged bool + type ModerationResultCategories struct + Hate bool + HateThreatening bool + SelfHarm bool + Sexual bool + SexualMinors bool + Violence bool + ViolenceGraphic bool + type ModerationResultCategoryScores struct + Hate float64 + HateThreatening float64 + SelfHarm float64 + Sexual float64 + SexualMinors float64 + Violence float64 + ViolenceGraphic float64 + type ModerationsAPI interface + Create func(ModerationParams) (Moderation, error) + type TokenUsage struct + CompletionTokens int + PromptTokens int + TotalTokens int