llm-fns 1.0.16 → 1.0.17

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.
@@ -206,6 +206,11 @@ function createLlmClient(params) {
206
206
  const task = () => (0, retryUtils_js_1.executeWithRetry)(async () => {
207
207
  return openai.chat.completions.create(completionParams);
208
208
  }, async (completion) => {
209
+ if (completion.error) {
210
+ return {
211
+ isValid: false,
212
+ };
213
+ }
209
214
  return { isValid: true, data: completion };
210
215
  }, retries ?? 3, undefined, (error) => {
211
216
  // Do not retry if the API key is invalid (401) or if the error code explicitly states it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-fns",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",