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 Assistants
- func (s *Assistants) CancelRun(ctx context.Context, runID string, threadID string) (*operations.CancelRunResponse, error)
- func (s *Assistants) CreateAssistant(ctx context.Context, request shared.CreateAssistantRequest) (*operations.CreateAssistantResponse, error)
- func (s *Assistants) CreateAssistantFile(ctx context.Context, ...) (*operations.CreateAssistantFileResponse, error)
- func (s *Assistants) CreateMessage(ctx context.Context, createMessageRequest shared.CreateMessageRequest, ...) (*operations.CreateMessageResponse, error)
- func (s *Assistants) CreateRun(ctx context.Context, createRunRequest shared.CreateRunRequest, threadID string) (*operations.CreateRunResponse, error)
- func (s *Assistants) CreateThread(ctx context.Context, request *shared.CreateThreadRequest) (*operations.CreateThreadResponse, error)
- func (s *Assistants) CreateThreadAndRun(ctx context.Context, request shared.CreateThreadAndRunRequest) (*operations.CreateThreadAndRunResponse, error)
- func (s *Assistants) DeleteAssistant(ctx context.Context, assistantID string) (*operations.DeleteAssistantResponse, error)
- func (s *Assistants) DeleteAssistantFile(ctx context.Context, assistantID string, fileID string) (*operations.DeleteAssistantFileResponse, error)
- func (s *Assistants) DeleteThread(ctx context.Context, threadID string) (*operations.DeleteThreadResponse, error)
- func (s *Assistants) GetAssistant(ctx context.Context, assistantID string) (*operations.GetAssistantResponse, error)
- func (s *Assistants) GetAssistantFile(ctx context.Context, assistantID string, fileID string) (*operations.GetAssistantFileResponse, error)
- func (s *Assistants) GetMessage(ctx context.Context, messageID string, threadID string) (*operations.GetMessageResponse, error)
- func (s *Assistants) GetMessageFile(ctx context.Context, fileID string, messageID string, threadID string) (*operations.GetMessageFileResponse, error)
- func (s *Assistants) GetRun(ctx context.Context, runID string, threadID string) (*operations.GetRunResponse, error)
- func (s *Assistants) GetRunStep(ctx context.Context, runID string, stepID string, threadID string) (*operations.GetRunStepResponse, error)
- func (s *Assistants) GetThread(ctx context.Context, threadID string) (*operations.GetThreadResponse, error)
- func (s *Assistants) ListAssistantFiles(ctx context.Context, request operations.ListAssistantFilesRequest) (*operations.ListAssistantFilesResponse, error)
- func (s *Assistants) ListAssistants(ctx context.Context, after *string, before *string, limit *int64, ...) (*operations.ListAssistantsResponse, error)
- func (s *Assistants) ListMessageFiles(ctx context.Context, request operations.ListMessageFilesRequest) (*operations.ListMessageFilesResponse, error)
- func (s *Assistants) ListMessages(ctx context.Context, request operations.ListMessagesRequest) (*operations.ListMessagesResponse, error)
- func (s *Assistants) ListRunSteps(ctx context.Context, request operations.ListRunStepsRequest) (*operations.ListRunStepsResponse, error)
- func (s *Assistants) ListRuns(ctx context.Context, request operations.ListRunsRequest) (*operations.ListRunsResponse, error)
- func (s *Assistants) ModifyAssistant(ctx context.Context, modifyAssistantRequest shared.ModifyAssistantRequest, ...) (*operations.ModifyAssistantResponse, error)
- func (s *Assistants) ModifyMessage(ctx context.Context, modifyMessageRequest shared.ModifyMessageRequest, ...) (*operations.ModifyMessageResponse, error)
- func (s *Assistants) ModifyRun(ctx context.Context, modifyRunRequest shared.ModifyRunRequest, runID string, ...) (*operations.ModifyRunResponse, error)
- func (s *Assistants) ModifyThread(ctx context.Context, modifyThreadRequest shared.ModifyThreadRequest, ...) (*operations.ModifyThreadResponse, error)
- func (s *Assistants) SubmitToolOuputsToRun(ctx context.Context, ...) (*operations.SubmitToolOuputsToRunResponse, error)
- type Audio
- func (s *Audio) CreateSpeech(ctx context.Context, request shared.CreateSpeechRequest) (*operations.CreateSpeechResponse, error)
- func (s *Audio) CreateTranscription(ctx context.Context, request shared.CreateTranscriptionRequest) (*operations.CreateTranscriptionResponse, error)
- func (s *Audio) CreateTranslation(ctx context.Context, request shared.CreateTranslationRequest) (*operations.CreateTranslationResponse, error)
- type Chat
- type Completions
- type Embeddings
- type Files
- func (s *Files) CreateFile(ctx context.Context, request shared.CreateFileRequest) (*operations.CreateFileResponse, error)
- func (s *Files) DeleteFile(ctx context.Context, fileID string) (*operations.DeleteFileResponse, error)
- func (s *Files) DownloadFile(ctx context.Context, fileID string) (*operations.DownloadFileResponse, error)
- func (s *Files) ListFiles(ctx context.Context, purpose *string) (*operations.ListFilesResponse, error)
- func (s *Files) RetrieveFile(ctx context.Context, fileID string) (*operations.RetrieveFileResponse, error)
- type FineTuning
- func (s *FineTuning) CancelFineTuningJob(ctx context.Context, fineTuningJobID string) (*operations.CancelFineTuningJobResponse, error)
- func (s *FineTuning) CreateFineTuningJob(ctx context.Context, request shared.CreateFineTuningJobRequest) (*operations.CreateFineTuningJobResponse, error)
- func (s *FineTuning) ListFineTuningEvents(ctx context.Context, fineTuningJobID string, after *string, limit *int64) (*operations.ListFineTuningEventsResponse, error)
- func (s *FineTuning) ListPaginatedFineTuningJobs(ctx context.Context, after *string, limit *int64) (*operations.ListPaginatedFineTuningJobsResponse, error)
- func (s *FineTuning) RetrieveFineTuningJob(ctx context.Context, fineTuningJobID string) (*operations.RetrieveFineTuningJobResponse, error)
- type Gpt
- type HTTPClient
- type Images
- func (s *Images) CreateImage(ctx context.Context, request shared.CreateImageRequest) (*operations.CreateImageResponse, error)
- func (s *Images) CreateImageEdit(ctx context.Context, request shared.CreateImageEditRequest) (*operations.CreateImageEditResponse, error)
- func (s *Images) CreateImageVariation(ctx context.Context, request shared.CreateImageVariationRequest) (*operations.CreateImageVariationResponse, error)
- type Models
- func (s *Models) DeleteModel(ctx context.Context, model string) (*operations.DeleteModelResponse, error)
- func (s *Models) ListModels(ctx context.Context) (*operations.ListModelsResponse, error)
- func (s *Models) RetrieveModel(ctx context.Context, model string) (*operations.RetrieveModelResponse, error)
- type Moderations
- type SDKOption
- func WithClient(client HTTPClient) SDKOption
- func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption
- func WithSecurity(apiKeyAuth string) 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
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 Assistants ¶
type Assistants struct {
// contains filtered or unexported fields
}
Build Assistants that can call models and use tools.
func (*Assistants) CancelRun ¶
func (s *Assistants) CancelRun(ctx context.Context, runID string, threadID string) (*operations.CancelRunResponse, error)
CancelRun - Cancels a run that is `in_progress`.
func (*Assistants) CreateAssistant ¶
func (s *Assistants) CreateAssistant(ctx context.Context, request shared.CreateAssistantRequest) (*operations.CreateAssistantResponse, error)
CreateAssistant - Create an assistant with a model and instructions.
func (*Assistants) CreateAssistantFile ¶
func (s *Assistants) CreateAssistantFile(ctx context.Context, createAssistantFileRequest shared.CreateAssistantFileRequest, assistantID string) (*operations.CreateAssistantFileResponse, error)
CreateAssistantFile - Create an assistant file by attaching a [File](/docs/api-reference/files) to an [assistant](/docs/api-reference/assistants).
func (*Assistants) CreateMessage ¶
func (s *Assistants) CreateMessage(ctx context.Context, createMessageRequest shared.CreateMessageRequest, threadID string) (*operations.CreateMessageResponse, error)
CreateMessage - Create a message.
func (*Assistants) CreateRun ¶
func (s *Assistants) CreateRun(ctx context.Context, createRunRequest shared.CreateRunRequest, threadID string) (*operations.CreateRunResponse, error)
CreateRun - Create a run.
func (*Assistants) CreateThread ¶
func (s *Assistants) CreateThread(ctx context.Context, request *shared.CreateThreadRequest) (*operations.CreateThreadResponse, error)
CreateThread - Create a thread.
func (*Assistants) CreateThreadAndRun ¶
func (s *Assistants) CreateThreadAndRun(ctx context.Context, request shared.CreateThreadAndRunRequest) (*operations.CreateThreadAndRunResponse, error)
CreateThreadAndRun - Create a thread and run it in one request.
func (*Assistants) DeleteAssistant ¶
func (s *Assistants) DeleteAssistant(ctx context.Context, assistantID string) (*operations.DeleteAssistantResponse, error)
DeleteAssistant - Delete an assistant.
func (*Assistants) DeleteAssistantFile ¶
func (s *Assistants) DeleteAssistantFile(ctx context.Context, assistantID string, fileID string) (*operations.DeleteAssistantFileResponse, error)
DeleteAssistantFile - Delete an assistant file.
func (*Assistants) DeleteThread ¶
func (s *Assistants) DeleteThread(ctx context.Context, threadID string) (*operations.DeleteThreadResponse, error)
DeleteThread - Delete a thread.
func (*Assistants) GetAssistant ¶
func (s *Assistants) GetAssistant(ctx context.Context, assistantID string) (*operations.GetAssistantResponse, error)
GetAssistant - Retrieves an assistant.
func (*Assistants) GetAssistantFile ¶
func (s *Assistants) GetAssistantFile(ctx context.Context, assistantID string, fileID string) (*operations.GetAssistantFileResponse, error)
GetAssistantFile - Retrieves an AssistantFile.
func (*Assistants) GetMessage ¶
func (s *Assistants) GetMessage(ctx context.Context, messageID string, threadID string) (*operations.GetMessageResponse, error)
GetMessage - Retrieve a message.
func (*Assistants) GetMessageFile ¶
func (s *Assistants) GetMessageFile(ctx context.Context, fileID string, messageID string, threadID string) (*operations.GetMessageFileResponse, error)
GetMessageFile - Retrieves a message file.
func (*Assistants) GetRun ¶
func (s *Assistants) GetRun(ctx context.Context, runID string, threadID string) (*operations.GetRunResponse, error)
GetRun - Retrieves a run.
func (*Assistants) GetRunStep ¶
func (s *Assistants) GetRunStep(ctx context.Context, runID string, stepID string, threadID string) (*operations.GetRunStepResponse, error)
GetRunStep - Retrieves a run step.
func (*Assistants) GetThread ¶
func (s *Assistants) GetThread(ctx context.Context, threadID string) (*operations.GetThreadResponse, error)
GetThread - Retrieves a thread.
func (*Assistants) ListAssistantFiles ¶
func (s *Assistants) ListAssistantFiles(ctx context.Context, request operations.ListAssistantFilesRequest) (*operations.ListAssistantFilesResponse, error)
ListAssistantFiles - Returns a list of assistant files.
func (*Assistants) ListAssistants ¶
func (s *Assistants) ListAssistants(ctx context.Context, after *string, before *string, limit *int64, order *operations.QueryParamOrder) (*operations.ListAssistantsResponse, error)
ListAssistants - Returns a list of assistants.
func (*Assistants) ListMessageFiles ¶
func (s *Assistants) ListMessageFiles(ctx context.Context, request operations.ListMessageFilesRequest) (*operations.ListMessageFilesResponse, error)
ListMessageFiles - Returns a list of message files.
func (*Assistants) ListMessages ¶
func (s *Assistants) ListMessages(ctx context.Context, request operations.ListMessagesRequest) (*operations.ListMessagesResponse, error)
ListMessages - Returns a list of messages for a given thread.
func (*Assistants) ListRunSteps ¶
func (s *Assistants) ListRunSteps(ctx context.Context, request operations.ListRunStepsRequest) (*operations.ListRunStepsResponse, error)
ListRunSteps - Returns a list of run steps belonging to a run.
func (*Assistants) ListRuns ¶
func (s *Assistants) ListRuns(ctx context.Context, request operations.ListRunsRequest) (*operations.ListRunsResponse, error)
ListRuns - Returns a list of runs belonging to a thread.
func (*Assistants) ModifyAssistant ¶
func (s *Assistants) ModifyAssistant(ctx context.Context, modifyAssistantRequest shared.ModifyAssistantRequest, assistantID string) (*operations.ModifyAssistantResponse, error)
ModifyAssistant - Modifies an assistant.
func (*Assistants) ModifyMessage ¶
func (s *Assistants) ModifyMessage(ctx context.Context, modifyMessageRequest shared.ModifyMessageRequest, messageID string, threadID string) (*operations.ModifyMessageResponse, error)
ModifyMessage - Modifies a message.
func (*Assistants) ModifyRun ¶
func (s *Assistants) ModifyRun(ctx context.Context, modifyRunRequest shared.ModifyRunRequest, runID string, threadID string) (*operations.ModifyRunResponse, error)
ModifyRun - Modifies a run.
func (*Assistants) ModifyThread ¶
func (s *Assistants) ModifyThread(ctx context.Context, modifyThreadRequest shared.ModifyThreadRequest, threadID string) (*operations.ModifyThreadResponse, error)
ModifyThread - Modifies a thread.
func (*Assistants) SubmitToolOuputsToRun ¶
func (s *Assistants) SubmitToolOuputsToRun(ctx context.Context, submitToolOutputsRunRequest shared.SubmitToolOutputsRunRequest, runID string, threadID string) (*operations.SubmitToolOuputsToRunResponse, error)
SubmitToolOuputsToRun - When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
type Audio ¶
type Audio struct {
// contains filtered or unexported fields
}
Audio - Learn how to turn audio into text or text into audio.
func (*Audio) CreateSpeech ¶
func (s *Audio) CreateSpeech(ctx context.Context, request shared.CreateSpeechRequest) (*operations.CreateSpeechResponse, error)
CreateSpeech - Generates audio from the input text.
func (*Audio) CreateTranscription ¶
func (s *Audio) CreateTranscription(ctx context.Context, request shared.CreateTranscriptionRequest) (*operations.CreateTranscriptionResponse, error)
CreateTranscription - Transcribes audio into the input language.
func (*Audio) CreateTranslation ¶
func (s *Audio) CreateTranslation(ctx context.Context, request shared.CreateTranslationRequest) (*operations.CreateTranslationResponse, error)
CreateTranslation - Translates audio into English.
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
Chat - Given a list of messages comprising a conversation, the model will return a response.
func (*Chat) CreateChatCompletion ¶
func (s *Chat) CreateChatCompletion(ctx context.Context, request shared.CreateChatCompletionRequest) (*operations.CreateChatCompletionResponse, error)
CreateChatCompletion - Creates a model response for the given chat conversation.
type Completions ¶
type Completions struct {
// contains filtered or unexported fields
}
Completions - Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
func (*Completions) CreateCompletion ¶
func (s *Completions) CreateCompletion(ctx context.Context, request shared.CreateCompletionRequest) (*operations.CreateCompletionResponse, error)
CreateCompletion - Creates a completion for the provided prompt and parameters.
type Embeddings ¶
type Embeddings struct {
// contains filtered or unexported fields
}
Embeddings - Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
func (*Embeddings) CreateEmbedding ¶
func (s *Embeddings) CreateEmbedding(ctx context.Context, request shared.CreateEmbeddingRequest) (*operations.CreateEmbeddingResponse, error)
CreateEmbedding - Creates an embedding vector representing the input text.
type Files ¶
type Files struct {
// contains filtered or unexported fields
}
Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
func (*Files) CreateFile ¶
func (s *Files) CreateFile(ctx context.Context, request shared.CreateFileRequest) (*operations.CreateFileResponse, error)
CreateFile - Upload a file that can be used across various endpoints. The size of all the files uploaded by one organization can be up to 100 GB.
The size of individual files can be a maximum of 512 MB or 2 million tokens for Assistants. See the [Assistants Tools guide](/docs/assistants/tools) to learn more about the types of files supported. The Fine-tuning API only supports `.jsonl` files.
Please [contact us](https://help.openai.com/) if you need to increase these storage limits.
func (*Files) DeleteFile ¶
func (s *Files) DeleteFile(ctx context.Context, fileID string) (*operations.DeleteFileResponse, error)
DeleteFile - Delete a file.
func (*Files) DownloadFile ¶
func (s *Files) DownloadFile(ctx context.Context, fileID string) (*operations.DownloadFileResponse, error)
DownloadFile - Returns the contents of the specified file.
func (*Files) ListFiles ¶
func (s *Files) ListFiles(ctx context.Context, purpose *string) (*operations.ListFilesResponse, error)
ListFiles - Returns a list of files that belong to the user's organization.
func (*Files) RetrieveFile ¶
func (s *Files) RetrieveFile(ctx context.Context, fileID string) (*operations.RetrieveFileResponse, error)
RetrieveFile - Returns information about a specific file.
type FineTuning ¶
type FineTuning struct {
// contains filtered or unexported fields
}
FineTuning - Manage fine-tuning jobs to tailor a model to your specific training data.
func (*FineTuning) CancelFineTuningJob ¶
func (s *FineTuning) CancelFineTuningJob(ctx context.Context, fineTuningJobID string) (*operations.CancelFineTuningJobResponse, error)
CancelFineTuningJob - Immediately cancel a fine-tune job.
func (*FineTuning) CreateFineTuningJob ¶
func (s *FineTuning) CreateFineTuningJob(ctx context.Context, request shared.CreateFineTuningJobRequest) (*operations.CreateFineTuningJobResponse, error)
CreateFineTuningJob - Creates a fine-tuning job which begins the process of creating a new 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 (*FineTuning) ListFineTuningEvents ¶
func (s *FineTuning) ListFineTuningEvents(ctx context.Context, fineTuningJobID string, after *string, limit *int64) (*operations.ListFineTuningEventsResponse, error)
ListFineTuningEvents - Get status updates for a fine-tuning job.
func (*FineTuning) ListPaginatedFineTuningJobs ¶
func (s *FineTuning) ListPaginatedFineTuningJobs(ctx context.Context, after *string, limit *int64) (*operations.ListPaginatedFineTuningJobsResponse, error)
ListPaginatedFineTuningJobs - List your organization's fine-tuning jobs
func (*FineTuning) RetrieveFineTuningJob ¶
func (s *FineTuning) RetrieveFineTuningJob(ctx context.Context, fineTuningJobID string) (*operations.RetrieveFineTuningJobResponse, error)
RetrieveFineTuningJob - Get info about a fine-tuning job.
[Learn more about fine-tuning](/docs/guides/fine-tuning)
type Gpt ¶
type Gpt struct { // Build Assistants that can call models and use tools. Assistants *Assistants // Learn how to turn audio into text or text into audio. Audio *Audio // Given a list of messages comprising a conversation, the model will return a response. Chat *Chat // Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. Completions *Completions // Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. Embeddings *Embeddings // Files are used to upload documents that can be used with features like Assistants and Fine-tuning. Files *Files // Manage fine-tuning jobs to tailor a model to your specific training data. FineTuning *FineTuning // Given a prompt and/or an input image, the model will generate a new image. Images *Images // List and describe the various models available in the API. Models *Models // Given a input text, outputs if the model classifies it as violating OpenAI's content policy. Moderations *Moderations // contains filtered or unexported fields }
Gpt - OpenAI API: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
type HTTPClient ¶
HTTPClient provides an interface for suplying the SDK with a custom HTTP client
type Images ¶
type Images struct {
// contains filtered or unexported fields
}
Images - Given a prompt and/or an input image, the model will generate a new image.
func (*Images) CreateImage ¶
func (s *Images) CreateImage(ctx context.Context, request shared.CreateImageRequest) (*operations.CreateImageResponse, error)
CreateImage - Creates an image given a prompt.
func (*Images) CreateImageEdit ¶
func (s *Images) CreateImageEdit(ctx context.Context, request shared.CreateImageEditRequest) (*operations.CreateImageEditResponse, error)
CreateImageEdit - Creates an edited or extended image given an original image and a prompt.
func (*Images) CreateImageVariation ¶
func (s *Images) CreateImageVariation(ctx context.Context, request shared.CreateImageVariationRequest) (*operations.CreateImageVariationResponse, error)
CreateImageVariation - Creates a variation of a given image.
type Models ¶
type Models struct {
// contains filtered or unexported fields
}
Models - List and describe the various models available in the API.
func (*Models) DeleteModel ¶
func (s *Models) DeleteModel(ctx context.Context, model string) (*operations.DeleteModelResponse, error)
DeleteModel - Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
func (*Models) ListModels ¶
func (s *Models) ListModels(ctx context.Context) (*operations.ListModelsResponse, error)
ListModels - Lists the currently available models, and provides basic information about each one such as the owner and availability.
func (*Models) RetrieveModel ¶
func (s *Models) RetrieveModel(ctx context.Context, model string) (*operations.RetrieveModelResponse, error)
RetrieveModel - Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
type Moderations ¶
type Moderations struct {
// contains filtered or unexported fields
}
Moderations - Given a input text, outputs if the model classifies it as violating OpenAI's content policy.
func (*Moderations) CreateModeration ¶
func (s *Moderations) CreateModeration(ctx context.Context, request shared.CreateModerationRequest) (*operations.CreateModerationResponse, error)
CreateModeration - Classifies if text violates OpenAI's Content Policy
type SDKOption ¶
type SDKOption func(*Gpt)
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 utils.RetryConfig) SDKOption
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