Skip to content

Commit

Permalink
bug: statusCode not defined properly
Browse files Browse the repository at this point in the history
  • Loading branch information
samestrin committed Jul 22, 2024
1 parent 763f38d commit ebf3cb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Star on GitHub](https://img.shields.io/github/stars/samestrin/llm-interface?style=social)](https://github.com/samestrin/llm-interface/stargazers) [![Fork on GitHub](https://img.shields.io/github/forks/samestrin/llm-interface?style=social)](https://github.com/samestrin/llm-interface/network/members) [![Watch on GitHub](https://img.shields.io/github/watchers/samestrin/llm-interface?style=social)](https://github.com/samestrin/llm-interface/watchers)

![Version 2.0.149](https://img.shields.io/badge/Version-2.0.149-blue) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Built with Node.js](https://img.shields.io/badge/Built%20with-Node.js-green)](https://nodejs.org/)
![Version 2.0.1491](https://img.shields.io/badge/Version-2.0.1491-blue) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Built with Node.js](https://img.shields.io/badge/Built%20with-Node.js-green)](https://nodejs.org/)

## Introduction

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "llm-interface",
"version": "2.0.149",
"version": "2.0.1491",
"main": "src/index.js",
"description": "A simple, unified NPM-based interface for interacting with multiple Large Language Model (LLM) APIs, including OpenAI, AI21 Studio, Anthropic, Cloudflare AI, Cohere, Fireworks AI, Google Gemini, Goose AI, Groq, Hugging Face, Mistral AI, Perplexity, Reka AI, watsonx.ai, and LLaMA.cpp.",
"type": "commonjs",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/retryWithBackoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { SendMessageError, EmbeddingsError } = require('./errors.js');
const { delay } = require('./utils.js');
const { hrtime } = require('process');
const log = require('loglevel');
log.setLevel(log.levels.SILENT);

/**
* Retries the provided function with exponential backoff and handles specific HTTP errors.
Expand All @@ -19,6 +18,7 @@ async function retryWithBackoff(fn, options, errorType) {
let { retryAttempts = 3, retryMultiplier = 0.3 } = options;
let currentRetry = 0;
let lastError;
let statusCode = 0;

while (retryAttempts > 0) {
try {
Expand All @@ -33,7 +33,7 @@ async function retryWithBackoff(fn, options, errorType) {
}
} catch (error) {
lastError = error;
const statusCode = error.response?.status;
statusCode = error.response?.status;
const delayTime = (currentRetry + 1) * retryMultiplier * 1000 + 500;

switch (statusCode) {
Expand Down

0 comments on commit ebf3cb9

Please sign in to comment.