Documentation ¶
Index ¶
- func Encode(v interface{}) (io.Reader, error)
- type AudioTranscriptionResponse
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type ChatResponseChoice
- type Choice
- type CompletionRequest
- type CompletionResponse
- type Edit
- type EditRequest
- type EditResponse
- type Image
- type ImageRequest
- type ImageResponse
- type Model
- type ModelsResponse
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AudioTranscriptionResponse ¶ added in v0.3.0
type AudioTranscriptionResponse struct {
Text string `json:"text"`
}
AudioTranscriptionResponse response for a transcription request
func DecodeAudioTranscriptionResponse ¶ added in v0.3.0
func DecodeAudioTranscriptionResponse(body io.Reader) (AudioTranscriptionResponse, error)
DecodeAudioTranscriptionResponse decodes a response from the audio transcription endpoint
type ChatMessage ¶ added in v0.2.0
type ChatRequest ¶ added in v0.2.0
type ChatRequest struct { Model string `json:"model"` Messages []ChatMessage `json:"messages"` Temperature float64 `json:"temperature"` TopP float64 `json:"top_p"` N int `json:"n"` Stream bool `json:"stream"` Stop []string `json:"stop"` MaxTokens int `json:"max_tokens"` PresencePenalty float64 `json:"presence_penalty"` FrequencyPenalty float64 `json:"frequency_penalty"` User string `json:"user"` }
ChatRequest represents a request to the chat endpoint
func NewDefaultChatRequest ¶ added in v0.2.0
func NewDefaultChatRequest(prompt string) *ChatRequest
NewDefaultChatRequest returns a ChatRequest with default values
type ChatResponse ¶ added in v0.2.0
type ChatResponse struct { ID string `json:"id"` Object string `json:"object"` Created int `json:"created"` Choices []ChatResponseChoice `json:"choices"` Usage Usage `json:"usage"` }
ChatResponse response for a chat request
func DecodeChatResponse ¶ added in v0.2.0
func DecodeChatResponse(body io.Reader) (ChatResponse, error)
DecodeChatResponse decodes a response from the chat endpoint
type ChatResponseChoice ¶ added in v0.2.0
type ChatResponseChoice struct { Index int `json:"index"` FinishReason string `json:"finish_reason"` Message ChatMessage `json:"message"` }
type Choice ¶
type Choice struct { Text string `json:"text"` Index int `json:"index"` LogProbs interface{} `json:"logprobs"` FinishReason string `json:"finish_reason"` }
Choice represents a choice that the API returns
type CompletionRequest ¶
type CompletionRequest struct { Model string `json:"model"` Prompt string `json:"prompt"` MaxTokens int `json:"max_tokens"` Temperature float64 `json:"temperature"` TopP float64 `json:"top_p"` N int `json:"n"` Stream bool `json:"stream"` Stop []string `json:"stop"` PresencePenalty float64 `json:"presence_penalty"` FrequencyPenalty float64 `json:"frequency_penalty"` BestOf int `json:"best_of"` User string `json:"user"` Suffix string `json:"suffix"` Echo bool `json:"echo"` }
func NewDefaultCompletionRequest ¶
func NewDefaultCompletionRequest(prompt string) *CompletionRequest
NewDefaultCompletionRequest returns a CompletionRequest with default values
type CompletionResponse ¶
type CompletionResponse struct { ID string `json:"id"` Object string `json:"object"` Created int `json:"created"` Model string `json:"model"` Choices []Choice `json:"choices"` Usage Usage `json:"usage"` }
CompletionResponse response for completion
func DecodeCompletionResponse ¶
func DecodeCompletionResponse(body io.Reader) (CompletionResponse, error)
DecodeCompletionResponse decodes a response from the completion endpoint
type EditRequest ¶
type EditRequest struct { Model string `json:"model"` Input string `json:"input"` Instructions string `json:"instruction"` Temperature float64 `json:"temperature"` N int `json:"n"` TopP float64 `json:"top_p"` }
func NewDefaultEditRequest ¶
func NewDefaultEditRequest(input, instructions string) *EditRequest
NewDefaultEditRequest returns a EditRequest with default values
type EditResponse ¶
type EditResponse struct { Object string `json:"object"` Created int `json:"created"` Model string `json:"model"` Edits []Edit `json:"choices"` Usage Usage `json:"usage"` }
EditResponse response for search
func DecodeEditResponse ¶
func DecodeEditResponse(body io.Reader) (EditResponse, error)
DecodeEditResponse decodes a response from the edit endpoint
type ImageRequest ¶
type ImageRequest struct { Prompt string `json:"prompt"` N int `json:"n"` Size string `json:"size"` ResponseFormat string `json:"response_format"` User string `json:"user"` }
func NewDefaultImageRequest ¶
func NewDefaultImageRequest(prompt string) *ImageRequest
NewDefaultImageRequest returns a ImageRequest with default values
type ImageResponse ¶
ImageResponse response for an image generation request
func DecodeImageResponse ¶
func DecodeImageResponse(body io.Reader) (ImageResponse, error)
DecodeImageResponse decodes a response from the image endpoint
type Model ¶
type Model struct { ID string `json:"id"` Object string `json:"object"` OwnedBy string `json:"owned_by"` Permission interface{} `json:"permission"` }
Model represents a model
type ModelsResponse ¶
ModelsResponse response for listing models
func DecodeModelsResponse ¶
func DecodeModelsResponse(body io.Reader) (ModelsResponse, error)
DecodeModelsResponse decodes a response from the models endpoint