provider-kit 0.1.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Every LLM has its own SDK. One API for all of them.
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Switch between OpenAI, Anthropic, Ollama, Google Gemini, and 38 more — without changing a line of code.** provider-kit wraps 42 LLM providers behind one consistent `chat()` interface, with built-in retry and timeout. �?same interface, built-in retry and timeout.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install provider-kit
|
|
@@ -141,4 +141,4 @@ const reply = await provider.chat('gpt-4', messages)
|
|
|
141
141
|
|
|
142
142
|
## Related
|
|
143
143
|
|
|
144
|
-
-
|
|
144
|
+
- `fairy-guardian` �?self-healing process cluster for AI model servers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "provider-kit",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "42 LLM provider unified API — one interface for OpenAI, Anthropic, Ollama, OpenRouter, and 38 more. Built-in retry, timeout, and error handling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -47,7 +47,10 @@ export async function withRetry(fn, { retries = 2, baseDelay = 1000, provider }
|
|
|
47
47
|
if (i === retries) throw e;
|
|
48
48
|
const isRetryable = e instanceof ProviderError ? e.retryable : true;
|
|
49
49
|
if (!isRetryable) throw e;
|
|
50
|
-
|
|
50
|
+
// Exponential backoff with jitter (±25%) to prevent thundering herd
|
|
51
|
+
const delay = baseDelay * Math.pow(2, i);
|
|
52
|
+
const jitter = delay * (0.75 + Math.random() * 0.5);
|
|
53
|
+
await new Promise(r => setTimeout(r, jitter));
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
}
|