Documentation ¶
Index ¶
- func ProcessAudioTranscriptions(process *process.Process) interface{}
- func ProcessChatCompletions(process *process.Process) interface{}
- func ProcessEmbeddings(process *process.Process) interface{}
- func ProcessTiktoken(process *process.Process) interface{}
- func Tiktoken(model string, input string) (int, error)
- type Error
- type ErrorMessage
- type Message
- type OpenAI
- func (openai OpenAI) AudioTranscriptions(dataBase64 string, option map[string]interface{}) (interface{}, *exception.Exception)
- func (openai OpenAI) ChatCompletions(messages []map[string]interface{}, option map[string]interface{}, ...) (interface{}, *exception.Exception)
- func (openai OpenAI) ChatCompletionsWith(ctx context.Context, messages []map[string]interface{}, ...) (interface{}, *exception.Exception)
- func (openai OpenAI) Completions(prompt interface{}, option map[string]interface{}, cb func(data []byte) int) (interface{}, *exception.Exception)
- func (openai OpenAI) CompletionsWith(ctx context.Context, prompt interface{}, option map[string]interface{}, ...) (interface{}, *exception.Exception)
- func (openai OpenAI) Edits(instruction string, option map[string]interface{}) (interface{}, *exception.Exception)
- func (openai OpenAI) Embeddings(input interface{}, user string) (interface{}, *exception.Exception)
- func (openai OpenAI) GetContent(response interface{}) (string, *exception.Exception)
- func (openai OpenAI) ImagesEdits(imageBase64 string, prompt string, option map[string]interface{}) (interface{}, *exception.Exception)
- func (openai OpenAI) ImagesGenerations(prompt string, option map[string]interface{}) (interface{}, *exception.Exception)
- func (openai OpenAI) ImagesVariations(imageBase64 string, option map[string]interface{}) (interface{}, *exception.Exception)
- func (openai OpenAI) MaxToken() int
- func (openai OpenAI) Tiktoken(input string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessAudioTranscriptions ¶
ProcessAudioTranscriptions openai.audio.Transcriptions
func ProcessChatCompletions ¶
ProcessChatCompletions openai.chat.Completions
func ProcessEmbeddings ¶
ProcessEmbeddings openai.Embeddings
func ProcessTiktoken ¶
ProcessTiktoken openai.Tiktoken
Types ¶
type Error ¶
type Error struct { Message string `json:"message,omitempty"` Type string `json:"type,omitempty"` Param interface{} `json:"param,omitempty"` Code string `json:"code,omitempty"` }
Error is the error response from OpenAI
type ErrorMessage ¶
type ErrorMessage struct {
Error Error `json:"error,omitempty"`
}
ErrorMessage is the error response from OpenAI
type Message ¶
type Message struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Created int64 `json:"created,omitempty"` Model string `json:"model,omitempty"` Choices []struct { Delta struct { Content string `json:"content,omitempty"` } `json:"delta,omitempty"` Index int `json:"index,omitempty"` FinishReason string `json:"finish_reason,omitempty"` } `json:"choices,omitempty"` }
Message is the response from OpenAI {"id":"chatcmpl-7Atx502nGBuYcvoZfIaWU4FREI1mT","object":"chat.completion.chunk","created":1682832715,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"Hello"},"index":0,"finish_reason":null}]}
type OpenAI ¶
type OpenAI struct {
// contains filtered or unexported fields
}
OpenAI struct
func (OpenAI) AudioTranscriptions ¶
func (openai OpenAI) AudioTranscriptions(dataBase64 string, option map[string]interface{}) (interface{}, *exception.Exception)
AudioTranscriptions Transcribes audio into the input language. https://platform.openai.com/docs/api-reference/audio/create
func (OpenAI) ChatCompletions ¶
func (openai OpenAI) ChatCompletions(messages []map[string]interface{}, option map[string]interface{}, cb func(data []byte) int) (interface{}, *exception.Exception)
ChatCompletions Creates a model response for the given chat conversation. https://platform.openai.com/docs/api-reference/chat/create
func (OpenAI) ChatCompletionsWith ¶
func (openai OpenAI) ChatCompletionsWith(ctx context.Context, messages []map[string]interface{}, option map[string]interface{}, cb func(data []byte) int) (interface{}, *exception.Exception)
ChatCompletionsWith Creates a model response for the given chat conversation. https://platform.openai.com/docs/api-reference/chat/create
func (OpenAI) Completions ¶
func (openai OpenAI) Completions(prompt interface{}, option map[string]interface{}, cb func(data []byte) int) (interface{}, *exception.Exception)
Completions Creates a completion for the provided prompt and parameters. https://platform.openai.com/docs/api-reference/completions/create
func (OpenAI) CompletionsWith ¶
func (openai OpenAI) CompletionsWith(ctx context.Context, prompt interface{}, option map[string]interface{}, cb func(data []byte) int) (interface{}, *exception.Exception)
CompletionsWith Creates a completion for the provided prompt and parameters. https://platform.openai.com/docs/api-reference/completions/create
func (OpenAI) Edits ¶
func (openai OpenAI) Edits(instruction string, option map[string]interface{}) (interface{}, *exception.Exception)
Edits Creates a new edit for the provided input, instruction, and parameters. https://platform.openai.com/docs/api-reference/edits/create
func (OpenAI) Embeddings ¶
Embeddings Creates an embedding vector representing the input text. https://platform.openai.com/docs/api-reference/embeddings/create
func (OpenAI) GetContent ¶
GetContent get the content of chat completions
func (OpenAI) ImagesEdits ¶
func (openai OpenAI) ImagesEdits(imageBase64 string, prompt string, option map[string]interface{}) (interface{}, *exception.Exception)
ImagesEdits Creates an edited or extended image given an original image and a prompt. https://platform.openai.com/docs/api-reference/images/create-edit
func (OpenAI) ImagesGenerations ¶
func (openai OpenAI) ImagesGenerations(prompt string, option map[string]interface{}) (interface{}, *exception.Exception)
ImagesGenerations Creates an image given a prompt. https://platform.openai.com/docs/api-reference/images
func (OpenAI) ImagesVariations ¶
func (openai OpenAI) ImagesVariations(imageBase64 string, option map[string]interface{}) (interface{}, *exception.Exception)
ImagesVariations Creates a variation of a given image. https://platform.openai.com/docs/api-reference/images/create-variation