Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
Increase wait times when receiving rate limit errors from OpenAI API
Dane Schneider6112dc0f5560
diff --git a/app/server/model/client.go b/app/server/model/client.goindex e175eb1f..31d613ab 100644--- a/app/server/model/client.go+++ b/app/server/model/client.go@@ -72,14 +72,15 @@ func createChatCompletionStream(if numRetry < 5 {// check if the error message contains a retry durationif duration := parseRetryAfter(err.Error()); duration != nil {- // ensure wait duration is less than 20 seconds- if *duration > 20*time.Second {+ // wait for the duration times 3 to give some buffer+ waitDuration := time.Duration(float64(*duration) * 3)++ // ensure wait duration is 60 seconds or less - for really long retries just error out+ if waitDuration > 120*time.Second {return nil, err+ } else if waitDuration > 60*time.Second {+ waitDuration = 60 * time.Second}-- log.Printf("Retry duration found: %v\n", *duration)- // wait for the duration times 1.5 to give some buffer- waitDuration := time.Duration(float64(*duration) * 1.5)time.Sleep(waitDuration)return createChatCompletionStream(client, ctx, req, numRetry+1)}@@ -129,14 +130,16 @@ func createChatCompletion(if duration := parseRetryAfter(err.Error()); duration != nil {log.Printf("Retry duration found: %v\n", *duration)- // ensure wait duration is less than 20 seconds- if *duration > 20*time.Second {+ // wait for the duration times 3 to give some buffer+ waitDuration := time.Duration(float64(*duration) * 3)++ // ensure wait duration is 60 seconds or less - for really long retries just error out+ if waitDuration > 120*time.Second {return openai.ChatCompletionResponse{}, err+ } else if waitDuration > 60*time.Second {+ waitDuration = 60 * time.Second}- // wait for the duration times 1.5 to give some buffer- waitDuration := time.Duration(float64(*duration) * 1.5)-time.Sleep(waitDuration)return createChatCompletion(client, ctx, req, numRetry+1)}diff --git a/releases/cli/versions/1.0.2.md b/releases/cli/versions/1.0.2.mdindex c0b3cde3..aead7b14 100644--- a/releases/cli/versions/1.0.2.md+++ b/releases/cli/versions/1.0.2.md@@ -3,4 +3,4 @@- `plandex convo` now accepts a message number or range of messages to display (e.g. `plandex convo 1`, `plandex convo 1-5`, `plandex convo 2-`). Use `plandex convo 1` to show the initial prompt.- Remove 'gpt-4-turbo-preview' from list of built-in models and model packs- Better help text if `plandex load` is run with incorrect arguments-- Fix for `plandex load` issue loading paths that begin with `./`\ No newline at end of file+- Fix for `plandex load` issue loading paths that begin with `./`diff --git a/releases/server/versions/1.0.2.md b/releases/server/versions/1.0.2.mdindex fd057ee1..d42f8ac1 100644--- a/releases/server/versions/1.0.2.md+++ b/releases/server/versions/1.0.2.md@@ -1,3 +1,4 @@- Give notes added to context with `plandex load -n 'some note'` automatically generated names in `context ls` list.- Fixes for summarization and auto-continue issues that could Plandex to lose track of where it is in the plan and repeat tasks or do tasks out of order, especially when using `tell` and `continue` after the initial `tell`.-- Improvements to the verification and auto-fix step. Plandex is now more likely to catch and fix placeholder references like "// ... existing code ..." as well as incorrect removal or overwriting of code.\ No newline at end of file+- Improvements to the verification and auto-fix step. Plandex is now more likely to catch and fix placeholder references like "// ... existing code ..." as well as incorrect removal or overwriting of code.+- Increase wait times when receiving rate limit errors from OpenAI API (common with new OpenAI accounts that haven't spent $50).\ No newline at end of file