Documentation ¶
Index ¶
- Variables
- type CompletionRequest
- type CompletionResponse
- type CostEstimator
- func (ce *CostEstimator) Count(input string) int
- func (ce *CostEstimator) EstimateCompletionCost(model string, tks int) (float64, error)
- func (ce *CostEstimator) EstimatePromptCost(model string, tks int) (float64, error)
- func (ce *CostEstimator) EstimateTotalCost(model string, promptTks, completionTks int) (float64, error)
- type Error
- type ErrorResponse
- type Metadata
- type TokenCounter
Constants ¶
This section is empty.
Variables ¶
View Source
var AnthropicPerMillionTokenCost = map[string]map[string]float64{
"prompt": {
"claude-instant": 0.8,
"claude": 8,
},
"completion": {
"claude-instant": 2.4,
"claude": 24,
},
}
Functions ¶
This section is empty.
Types ¶
type CompletionRequest ¶
type CompletionRequest struct { Model string `json:"model"` Prompt string `json:"prompt"` MaxTokensToSample int `json:"max_tokens_to_sample"` StopSequences []string `json:"stop_sequences,omitempty"` Temperature float32 `json:"temperature,omitempty"` TopP int `json:"top_p,omitempty"` TopK int `json:"top_k,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` Stream bool `json:"stream,omitempty"` }
type CompletionResponse ¶
type CostEstimator ¶
type CostEstimator struct {
// contains filtered or unexported fields
}
func NewCostEstimator ¶
func NewCostEstimator(tc tokenCounter) *CostEstimator
func (*CostEstimator) Count ¶
func (ce *CostEstimator) Count(input string) int
func (*CostEstimator) EstimateCompletionCost ¶
func (ce *CostEstimator) EstimateCompletionCost(model string, tks int) (float64, error)
func (*CostEstimator) EstimatePromptCost ¶
func (ce *CostEstimator) EstimatePromptCost(model string, tks int) (float64, error)
func (*CostEstimator) EstimateTotalCost ¶
func (ce *CostEstimator) EstimateTotalCost(model string, promptTks, completionTks int) (float64, error)
type ErrorResponse ¶
type ErrorResponse struct {
Error *Error `json:"error"`
}
type TokenCounter ¶
type TokenCounter struct {
// contains filtered or unexported fields
}
func NewTokenCounter ¶
func NewTokenCounter() (*TokenCounter, error)
func (*TokenCounter) Count ¶
func (tc *TokenCounter) Count(input string) int
Click to show internal directories.
Click to hide internal directories.