Documentation ¶
Index ¶
- Variables
- func Count(model string, input string) (int, error)
- type CostEstimator
- func (ce *CostEstimator) EstimateChatCompletionStreamCostWithTokenCounts(model string, content string) (int, float64, error)
- func (ce *CostEstimator) EstimateCompletionCost(model string, tks int) (float64, error)
- func (ce *CostEstimator) EstimateEmbeddingsCost(r *goopenai.EmbeddingRequest) (float64, error)
- func (ce *CostEstimator) EstimateEmbeddingsInputCost(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)
Constants ¶
This section is empty.
Variables ¶
View Source
var AzureOpenAiPerThousandTokenCost = map[string]map[string]float64{
"prompt": {
"gpt-4o": 0.005,
"gpt-4o-2024-05-13": 0.005,
"gpt-4-turbo": 0.01,
"gpt-4-turbo-2024-04-09": 0.01,
"gpt-4": 0.03,
"gpt-4-0125-preview": 0.03,
"gpt-4-32k": 0.06,
"gpt-4-vision": 0.06,
"gpt-35-turbo": 0.0015,
"gpt-35-turbo-instruct": 0.0015,
"gpt-35-turbo-16k": 0.003,
},
"embeddings": {
"ada": 0.0001,
"text-embedding-3-large": 0.00013,
"text-embedding-3-small": 0.00002,
},
"completion": {
"gpt-4o": 0.015,
"gpt-4o-2024-05-13": 0.015,
"gpt-4-turbo": 0.03,
"gpt-4-turbo-2024-04-09": 0.03,
"gpt-4": 0.06,
"gpt-4-0125-preview": 0.06,
"gpt-4-32k": 0.12,
"gpt-4-vision": 0.12,
"gpt-35-turbo": 0.002,
"gpt-35-turbo-instruct": 0.002,
"gpt-35-turbo-16k": 0.004,
},
}
Functions ¶
Types ¶
type CostEstimator ¶
type CostEstimator struct {
// contains filtered or unexported fields
}
func NewCostEstimator ¶
func NewCostEstimator() *CostEstimator
func (*CostEstimator) EstimateChatCompletionStreamCostWithTokenCounts ¶
func (*CostEstimator) EstimateCompletionCost ¶
func (ce *CostEstimator) EstimateCompletionCost(model string, tks int) (float64, error)
func (*CostEstimator) EstimateEmbeddingsCost ¶
func (ce *CostEstimator) EstimateEmbeddingsCost(r *goopenai.EmbeddingRequest) (float64, error)
func (*CostEstimator) EstimateEmbeddingsInputCost ¶
func (ce *CostEstimator) EstimateEmbeddingsInputCost(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)
Click to show internal directories.
Click to hide internal directories.