(req types.AIRequest, backend types.BackendMetadata)
| 11 | } |
| 12 | |
| 13 | func (e *SimpleEngine) Estimate(req types.AIRequest, backend types.BackendMetadata) types.CostEstimate { |
| 14 | maxTokens := req.Options.MaxTokens |
| 15 | if maxTokens <= 0 { |
| 16 | maxTokens = 256 |
| 17 | } |
| 18 | |
| 19 | estimatedTotal := backend.CostUnit + (float64(maxTokens)/1000.0)*backend.CostUnit |
| 20 | return types.CostEstimate{ |
| 21 | UnitCost: backend.CostUnit, |
| 22 | EstimatedTotal: estimatedTotal, |
| 23 | BudgetFit: true, |
| 24 | } |
| 25 | } |
no outgoing calls