@reverbia/sdk 1.0.0-next.20251215193957 → 1.0.0-next.20251217123222

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.
@@ -1482,6 +1482,7 @@ Please inform the user about this issue and try to help them alternatively.`
1482
1482
  toolExecution: toolExecutionResult
1483
1483
  };
1484
1484
  }
1485
+ let sseError = null;
1485
1486
  const sseResult = await client.sse.post({
1486
1487
  baseUrl,
1487
1488
  url: "/api/v1/chat/completions",
@@ -1495,7 +1496,11 @@ Please inform the user about this issue and try to help them alternatively.`
1495
1496
  Authorization: `Bearer ${token}`,
1496
1497
  ...headers
1497
1498
  },
1498
- signal: abortController.signal
1499
+ signal: abortController.signal,
1500
+ sseMaxRetryAttempts: 1,
1501
+ onSseError: (error) => {
1502
+ sseError = error instanceof Error ? error : new Error(String(error));
1503
+ }
1499
1504
  });
1500
1505
  const accumulator = createStreamAccumulator();
1501
1506
  for await (const chunk of sseResult.stream) {
@@ -1513,6 +1518,9 @@ Please inform the user about this issue and try to help them alternatively.`
1513
1518
  }
1514
1519
  }
1515
1520
  }
1521
+ if (sseError) {
1522
+ throw sseError;
1523
+ }
1516
1524
  const completion = buildCompletionResponse(accumulator);
1517
1525
  setIsLoading(false);
1518
1526
  if (onFinish) {
@@ -1419,6 +1419,7 @@ Please inform the user about this issue and try to help them alternatively.`
1419
1419
  toolExecution: toolExecutionResult
1420
1420
  };
1421
1421
  }
1422
+ let sseError = null;
1422
1423
  const sseResult = await client.sse.post({
1423
1424
  baseUrl,
1424
1425
  url: "/api/v1/chat/completions",
@@ -1432,7 +1433,11 @@ Please inform the user about this issue and try to help them alternatively.`
1432
1433
  Authorization: `Bearer ${token}`,
1433
1434
  ...headers
1434
1435
  },
1435
- signal: abortController.signal
1436
+ signal: abortController.signal,
1437
+ sseMaxRetryAttempts: 1,
1438
+ onSseError: (error) => {
1439
+ sseError = error instanceof Error ? error : new Error(String(error));
1440
+ }
1436
1441
  });
1437
1442
  const accumulator = createStreamAccumulator();
1438
1443
  for await (const chunk of sseResult.stream) {
@@ -1450,6 +1455,9 @@ Please inform the user about this issue and try to help them alternatively.`
1450
1455
  }
1451
1456
  }
1452
1457
  }
1458
+ if (sseError) {
1459
+ throw sseError;
1460
+ }
1453
1461
  const completion = buildCompletionResponse(accumulator);
1454
1462
  setIsLoading(false);
1455
1463
  if (onFinish) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reverbia/sdk",
3
- "version": "1.0.0-next.20251215193957",
3
+ "version": "1.0.0-next.20251217123222",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",