Documentation
¶
Index ¶
- Variables
- type API
- func (api *API) ChatCompletions(ctx context.Context, model string, messages []Message, ...) (ChatCompletionsResponse, error)
- func (api *API) Completions(ctx context.Context, model string, prompt string, maxTokens int32, ...) (CompletionsResponse, error)
- func (api *API) Embeddings(ctx context.Context, model string, input string, request EmbeddingsRequest) (EmbeddingsResponse, error)
- func (api *API) ListRunningInstances(ctx context.Context) (FineTuningResponse, error)
- func (api *API) StartFineTunedInstance(ctx context.Context, name string) (FineTuningResponse, error)
- func (api *API) StopFineTunedInstance(ctx context.Context, name string) (FineTuningResponse, error)
- type Args
- type ChatCompletionsRequest
- type ChatCompletionsResponse
- type Choice
- type ChoiceObject
- type CompletionsRequest
- type CompletionsResponse
- type EmbeddingsRequest
- type EmbeddingsResponse
- type FineTuningResponse
- type FunctionObject
- type Message
- type Output
- type ResponseFormatObject
- type Subjob
- type Tags
- type Tool
- type ToolChoiceObject
- type UsageObject
Constants ¶
This section is empty.
Variables ¶
var (
Version string = "v1" // This corresponds to the version of the API and is used in the URL path
)
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
APIKey string
BaseURL string
UserAgent string
Client *retryablehttp.Client
Debug bool
// contains filtered or unexported fields
}
func (*API) ChatCompletions ¶
func (api *API) ChatCompletions(ctx context.Context, model string, messages []Message, request ChatCompletionsRequest) (ChatCompletionsResponse, error)
Chat Completions is the endpoint for chat and moderation models on Together AI.
API Reference: https://docs.together.ai/reference/chat-completions
func (*API) Completions ¶
func (api *API) Completions(ctx context.Context, model string, prompt string, maxTokens int32, request CompletionsRequest) (CompletionsResponse, error)
Completions is the endpoint for language, code, and image models on Together AI.
API Reference: https://docs.together.ai/reference/completions
func (*API) Embeddings ¶
func (api *API) Embeddings(ctx context.Context, model string, input string, request EmbeddingsRequest) (EmbeddingsResponse, error)
Embeddings is the endpoint for embedding models on Together AI.
API Reference: https://docs.together.ai/reference/embeddings
func (*API) ListRunningInstances ¶
func (api *API) ListRunningInstances(ctx context.Context) (FineTuningResponse, error)
List Running Instances is the endpoint for listing running fine-tuning instances.
API Reference: https://docs.together.ai/reference/instances
func (*API) StartFineTunedInstance ¶
func (api *API) StartFineTunedInstance(ctx context.Context, name string) (FineTuningResponse, error)
Start Fine-tuned Instance is the endpoint for starting a fine-tuned model.
API Reference: https://docs.together.ai/reference/instances-start
func (*API) StopFineTunedInstance ¶
Stop Fine-tuned Instance is the endpoint for stopping a fine-tuned model.
API Reference: https://docs.together.ai/reference/instances-stop
type ChatCompletionsRequest ¶
type ChatCompletionsRequest struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
Stream bool `json:"stream"`
MaxTokens int32 `json:"max_tokens"`
Stop []string `json:"stop"`
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
TopK int32 `json:"top_k"`
RepetitionPenalty float64 `json:"repetition_penalty"`
Logprobs int32 `json:"logprobs"`
Echo bool `json:"echo"`
N int32 `json:"n"`
SafetyModel string `json:"safety_model"`
ResponseFormat ResponseFormatObject `json:"response_format"`
Tools []Tool `json:"tools"`
ToolChoice []ToolChoiceObject `json:"tool_choice"`
FrequencyPenalty float64 `json:"frequency_penalty"`
PresencePenalty float64 `json:"presence_penalty"`
MinP float64 `json:"min_p"`
}
type ChatCompletionsResponse ¶
type ChoiceObject ¶
type ChoiceObject struct {
Text string `json:"text"`
}
type CompletionsRequest ¶
type CompletionsRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
MaxTokens int32 `json:"max_tokens"`
Stream bool `json:"stream"`
Stop []string `json:"stop"`
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
TopK int32 `json:"top_k"`
RepetitionPenalty float64 `json:"repetition_penalty"`
Logprobs int32 `json:"logprobs"`
Echo bool `json:"echo"`
N int32 `json:"n"`
SafetyModel string `json:"safety_model"`
}
type CompletionsResponse ¶
type CompletionsResponse struct {
Id string `json:"id"`
Choices []ChoiceObject `json:"choices"`
Usage UsageObject `json:"usage"`
Created int `json:"created"`
Model string `json:"model"`
Object string `json:"object"`
}
type EmbeddingsRequest ¶
type EmbeddingsResponse ¶
type EmbeddingsResponse struct {
Status string `json:"status"`
Prompt []string `json:"prompt"`
Model string `json:"model"`
ModelOwner string `json:"model_owner"`
Tags Tags `json:"tags"`
NumReturns int `json:"num_returns"`
Args Args `json:"args"`
Subjobs []Subjob `json:"subjobs"`
Output Output `json:"output"`
}
type FineTuningResponse ¶
type FineTuningResponse struct {
Status string `json:"status"`
Prompt []string `json:"prompt"`
Model string `json:"model"`
ModelOwner string `json:"model_owner"`
Tags Tags `json:"tags"` // API Documentation states this is an object, but does not define it or provide an example.
NumReturns int `json:"num_returns"`
Args Args `json:"args"`
Subjobs []Subjob `json:"subjobs"` // API Documentation states this is an array, but does not define it or provide an example.
Output Output `json:"output"`
}
type FunctionObject ¶
type FunctionObject struct {
Description string `json:"description"`
Name string `json:"name"`
Parameters json.RawMessage `json:"parameters"` // maybe should be *json.RawMessage ?
}
type ResponseFormatObject ¶
type ResponseFormatObject struct {
Type string `json:"type"`
Schema json.RawMessage `json:"schema"` // maybe should be *json.RawMessage ?
}
type Tool ¶
type Tool struct {
Type string `json:"type"`
Function FunctionObject `json:"function"`
}
type ToolChoiceObject ¶
type ToolChoiceObject struct {
Type string `json:"type"`
Function FunctionObject `json:"function"`
}