Skip to content

Commit

Permalink
Upgrade summaries from 3.5 turbo to 4.0o mini.
Browse files Browse the repository at this point in the history
Thread summaries were previously completed using openai's gpt 3.5
turbo model. However, their recent release of 4.0o mini is 60% cheaper
and performs better.

https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/
  • Loading branch information
mikeb26 committed Jul 22, 2024
1 parent 6dbb547 commit 12f3f57
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ clean:
deps:
rm -rf go.mod go.sum vendor
go mod init github.com/mikeb26/gptcli
go mod edit -replace=github.com/sashabaranov/go-openai=github.com/mikeb26/sashabaranov-go-openai@v1.24.1.mb1
go mod edit -replace=github.com/sashabaranov/go-openai=github.com/mikeb26/sashabaranov-go-openai@v1.27.0.mb1
GOPROXY=direct go mod tidy
go mod vendor

Expand Down
4 changes: 2 additions & 2 deletions cmd/gptcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ func getCmdOrPrompt(gptCliCtx *GptCliContext) (string, error) {
}

// in order to reduce costs, summarize the prior dialogue history with
// the GPT3Dot5Turbo when resending the thread to OpenAI
// the GPT4oMini when resending the thread to OpenAI
func summarizeDialogue(ctx context.Context, gptCliCtx *GptCliContext,
dialogue []openai.ChatCompletionMessage) ([]openai.ChatCompletionMessage,
error) {
Expand All @@ -878,7 +878,7 @@ func summarizeDialogue(ctx context.Context, gptCliCtx *GptCliContext,
fmt.Printf("gptcli: summarizing...\n")
resp, err := gptCliCtx.client.CreateChatCompletion(ctx,
openai.ChatCompletionRequest{
Model: openai.GPT3Dot5Turbo,
Model: openai.GPT4oMini,
Messages: dialogue,
},
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gptcli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func TestSummarizeDialogue(t *testing.T) {
Content: expectedSummaryContent,
}

expectedModel := openai.GPT3Dot5Turbo
expectedModel := openai.GPT4oMini
expectedRequest := openai.ChatCompletionRequest{
Model: expectedModel,
Messages: append(initialDialogue, openai.ChatCompletionMessage{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/mikeb26/gptcli

go 1.22.3

replace github.com/sashabaranov/go-openai => github.com/mikeb26/sashabaranov-go-openai v1.17.7-0.20240530172754-6020e24c08bd
replace github.com/sashabaranov/go-openai => github.com/mikeb26/sashabaranov-go-openai v1.17.7-0.20240722171420-a1f95a80cf3b

require (
github.com/fatih/color v1.17.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mikeb26/sashabaranov-go-openai v1.17.7-0.20240530172754-6020e24c08bd h1:6+KXzymgnb2t2veEa5iJtTN3fhS+h0gnnbiWzbM7eHc=
github.com/mikeb26/sashabaranov-go-openai v1.17.7-0.20240530172754-6020e24c08bd/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/mikeb26/sashabaranov-go-openai v1.17.7-0.20240722171420-a1f95a80cf3b h1:mOCQJXiEVinAFoftljbgawL0krtRTKfALWMA2LjM0nA=
github.com/mikeb26/sashabaranov-go-openai v1.17.7-0.20240722171420-a1f95a80cf3b/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
Expand Down

0 comments on commit 12f3f57

Please sign in to comment.