Skip to content

Commit

Permalink
Support local model and embedding in calculatePrice()
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Mar 8, 2024
1 parent 0b8e230 commit 2a8522e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions embedding/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func (p *LocalEmbeddingProvider) calculatePrice(res *EmbeddingResult) error {
pricePerThousandTokens = 0.00002
case strings.Contains(embeddingModel, "text-embedding-3-large"):
pricePerThousandTokens = 0.00013
case embeddingModel == "custom-embedding":
pricePerThousandTokens = 0.0001
default:
return fmt.Errorf("calculatePrice() error: unknown model type: %s", embeddingModel)
}
Expand Down
5 changes: 5 additions & 0 deletions model/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ func (p *LocalModelProvider) calculatePrice(modelResult *ModelResult) error {
outputPricePerThousandTokens = 0.06
}

// local custom model:
case model == "custom-model":
inputPricePerThousandTokens = 0.001
outputPricePerThousandTokens = 0.002

// dall-e model
case strings.Contains(model, "dall-e-3"):
modelResult.TotalPrice = float64(modelResult.ImageCount) * 0.08
Expand Down

0 comments on commit 2a8522e

Please sign in to comment.