Documentation ¶
Index ¶
- Constants
- type AudioGenRequest
- type AudioGenResponse
- type AudioTranscribeRequest
- type AudioTranscribeResponse
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type ErrorResponse
- type HTTPClient
- type ImageRequest
- type ImageResponse
- type ModelResponse
- type ShuttleClient
- func (sh *ShuttleClient) AudioGeneration(ctx context.Context, req *AudioGenRequest) (*AudioGenResponse, error)
- func (sh *ShuttleClient) ChatCompletion(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
- func (sh *ShuttleClient) GetModelByEndpoint(endpoint string) (*ModelResponse, error)
- func (sh *ShuttleClient) GetModels() (*ModelResponse, error)
- func (sh *ShuttleClient) ImageGeneration(ctx context.Context, req *ImageRequest) (*ImageResponse, error)
- func (sh *ShuttleClient) TranscribeAudio(ctx context.Context, req *AudioTranscribeRequest) (*AudioTranscribeResponse, error)
Constants ¶
View Source
const APIBaseURL = "https://api.shuttleai.app"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioGenRequest ¶
type AudioGenRequest struct { //required Input string `json:"input"` //required Model string `json:"model"` //The voice to use for the generation > Voices can be found https://api.shuttleai.app/v1/models Voice *string `json:"voice,omitempty"` }
type AudioGenResponse ¶
type AudioTranscribeRequest ¶
type AudioTranscribeRequest struct {
File []byte `json:"file"`
}
type AudioTranscribeResponse ¶
type AudioTranscribeResponse struct {
Text string `json:"text"`
}
type ChatMessage ¶
type ChatRequest ¶
type ChatRequest struct { //Required Messages []ChatMessage `json:"messages"` //The id of the model to use for the generation Model string `json:"model"` //Whether to include citations in the generation > For use in owned_by: bing/openai models only, defaults to true. Citations *bool `json:"citations,omitempty"` Image *string `json:"image,omitempty"` //Whether to use the internet for the generation > Model limitations apply, defaults to true for bing models. Internet *bool `json:"internet,omitempty"` //The maximum number of tokens to generate MaxToken *int `json:"max_token,omitempty"` //Whether to return the raw response > For use in owned_by: bing/openai models only! Returns Bing AI Suggestions and Search Results, defaults to false. Raw *bool `json:"raw,omitempty"` //The temperature of the sampling distribution Temperature *int `json:"temperature,omitempty"` //The tone of the generation > For use in owned_by: bing/openai models only, defaults to precise. Tone *string `json:"tone,omitempty"` //The cumulative probability of the top tokens to keep in the nucleus of the distribution TopP *int `json:"top_p,omitempty"` }
type ChatResponse ¶
type ChatResponse struct { Choices []struct { FinishReason string `json:"finish_reason"` Index int `json:"index"` Logprobs struct { } `json:"logprobs"` Message struct { Content string `json:"content"` Role string `json:"role"` } `json:"message"` } `json:"choices"` Created int `json:"created"` ID string `json:"id"` Model string `json:"model"` Object string `json:"object"` SystemFingerprint string `json:"system_fingerprint"` Usage struct { CompletionTokens int `json:"completion_tokens"` PromptTokens int `json:"prompt_tokens"` TotalTokens int `json:"total_tokens"` } `json:"usage"` }
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type ImageRequest ¶
type ImageResponse ¶
type ModelResponse ¶
type ModelResponse []struct { Data []struct { Cost int `json:"cost"` Created int `json:"created"` ID string `json:"id"` Object string `json:"object"` OwnedBy string `json:"owned_by"` Premium bool `json:"premium"` Tokens int `json:"tokens"` } `json:"data"` Object string `json:"object"` }
example of endpoint: /v1/images/generations
type ShuttleClient ¶
type ShuttleClient struct { Httpclient HTTPClient ApiKey string Baseurl string }
func NewClient ¶
func NewClient(apikey string) *ShuttleClient
func (*ShuttleClient) AudioGeneration ¶
func (sh *ShuttleClient) AudioGeneration(ctx context.Context, req *AudioGenRequest) (*AudioGenResponse, error)
func (*ShuttleClient) ChatCompletion ¶
func (sh *ShuttleClient) ChatCompletion(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
func (*ShuttleClient) GetModelByEndpoint ¶
func (sh *ShuttleClient) GetModelByEndpoint(endpoint string) (*ModelResponse, error)
func (*ShuttleClient) GetModels ¶
func (sh *ShuttleClient) GetModels() (*ModelResponse, error)
func (*ShuttleClient) ImageGeneration ¶
func (sh *ShuttleClient) ImageGeneration(ctx context.Context, req *ImageRequest) (*ImageResponse, error)
func (*ShuttleClient) TranscribeAudio ¶
func (sh *ShuttleClient) TranscribeAudio(ctx context.Context, req *AudioTranscribeRequest) (*AudioTranscribeResponse, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.