Skip to content

Commit

Permalink
Update openai args.
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Aug 31, 2023
1 parent 190b280 commit b97a75a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/bll/jarvis.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (b *Jarvis) Summarize(ctx context.Context, input *TEInput) (*SummarizingOut
i := 0
for {
i += 1
if i > 400 {
if i > 1200 {
return nil, errors.New("summarizing timeout")
}

Expand Down Expand Up @@ -140,7 +140,7 @@ func (b *Jarvis) Translate(ctx context.Context, input *TEInput) (*TranslatingOut
i := 0
for {
i += 1
if i > 400 {
if i > 1200 {
return nil, errors.New("translating timeout")
}

Expand Down
4 changes: 2 additions & 2 deletions src/bll/walletbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

var AIModels = []AIModel{
// 4K context, i: $0.0015/1K tokens; o: $0.002/1K tokens; 0.157 WEN/1K tokens
{ID: "gpt-3.5", Name: "GPT-3.5", Price: 0.6}, // 0.6 wen/1K tokens
{ID: "gpt-3.5", Name: "GPT-3.5", Price: 1}, // 0.6 wen/1K tokens
// 8K context, i: $0.03/1K tokens; o: $0.06/1K tokens; 4.7 WEN/1K tokens
{ID: "gpt-4", Name: "GPT-4", Price: 8.0}, // 10 wen/1K tokens
{ID: "gpt-4", Name: "GPT-4", Price: 10}, // 10 wen/1K tokens
}

var DefaultModel = AIModels[0]
Expand Down
18 changes: 9 additions & 9 deletions src/bll/walletbase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ func TestModel(t *testing.T) {

assert.Equal(g35, GetAIModel("davinci"))

assert.Equal(float64(0.6), g35.Price)
assert.Equal(float64(8.0), g4.Price)
assert.Equal(float64(1.0), g35.Price)
assert.Equal(float64(10.0), g4.Price)

assert.Equal(int64(1), g35.CostWEN(100))
assert.Equal(int64(1), g35.CostWEN(1600))
assert.Equal(int64(2), g35.CostWEN(2100))
assert.Equal(int64(2), g35.CostWEN(2597))
assert.Equal(int64(6), g35.CostWEN(10000))
assert.Equal(int64(2), g35.CostWEN(1600))
assert.Equal(int64(3), g35.CostWEN(2100))
assert.Equal(int64(3), g35.CostWEN(2597))
assert.Equal(int64(10), g35.CostWEN(10000))
assert.Equal(int64(1), g4.CostWEN(100))
assert.Equal(int64(12), g4.CostWEN(1500))
assert.Equal(int64(21), g4.CostWEN(2597))
assert.Equal(int64(80), g4.CostWEN(10000))
assert.Equal(int64(15), g4.CostWEN(1500))
assert.Equal(int64(26), g4.CostWEN(2597))
assert.Equal(int64(100), g4.CostWEN(10000))
}

0 comments on commit b97a75a

Please sign in to comment.