You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# ResilientLLM
2
2
3
-
A robust LLM integration layer designed to ensure reliable, seamless interactions across multiple APIs by intelligently handling failures and rate limits.
3
+
A simple but robust LLM integration layer designed to ensure reliable, seamless interactions across multiple APIs by intelligently handling failures and rate limits.
4
4
5
5
## Motivation
6
6
@@ -34,7 +34,9 @@ const llm = new ResilientLLM({
34
34
rateLimitConfig: {
35
35
requestsPerMinute: 60, // Limit to 60 requests per minute
36
36
llmTokensPerMinute: 90000 // Limit to 90,000 LLM tokens per minute
Copy file name to clipboardExpand all lines: ResilientOperation.js
+9-14Lines changed: 9 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -244,10 +244,10 @@ class ResilientOperation {
244
244
*/
245
245
async_executeBasic(asyncFn,config, ...args){
246
246
247
-
letattempt=0;
247
+
letretryAttempt=0;
248
248
letdelay=1000;
249
249
250
-
while(attempt<=config.retries){
250
+
while(retryAttempt<=config.retries){
251
251
try{
252
252
// Check circuit breaker first
253
253
if(this.circuitBreaker.isCircuitOpen()){
@@ -275,13 +275,8 @@ class ResilientOperation {
275
275
this.circuitBreaker.recordSuccess();
276
276
277
277
// Log success with retry information
278
-
if(attempt>0){
279
-
conststatus=this.circuitBreaker.getStatus();
280
-
console.log(`[ResilientOperation][${this.id}] Operation succeeded after ${attempt} retries. Current fail count: ${status.failCount}/${status.failureThreshold}`);
281
-
}else{
282
-
conststatus=this.circuitBreaker.getStatus();
283
-
console.log(`[ResilientOperation][${this.id}] Operation succeeded on first attempt. Current fail count: ${status.failCount}/${status.failureThreshold}`);
284
-
}
278
+
conststatus=this.circuitBreaker.getStatus();
279
+
console.log(`[ResilientOperation][${this.id}] Operation succeeded after ${retryAttempt} retries. Current fail count: ${status.failCount}/${status.failureThreshold}`);
0 commit comments