oira666_pi-limits-wait 0.4.3 → 0.4.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oira666_pi-limits-wait",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Extension for PI that allows to automatically wait for limits to reset and retry the request",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -636,7 +636,7 @@ type StreamSimpleFn = (
636
636
  model: Model<Api>,
637
637
  context: Context,
638
638
  options?: SimpleStreamOptions,
639
- ) => AssistantMessageEventStream;
639
+ ) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;
640
640
 
641
641
  export function __configureFallbackModelsForTests(
642
642
  models: FallbackModel[],
@@ -712,7 +712,7 @@ export function streamWithLimitsRetry(
712
712
  : builtinStreamSimpleByApi.get(attempt.model.api)
713
713
  ?? getApiProviders().find((provider) => provider.api === attempt.model.api)?.streamSimple;
714
714
  if (!attemptDelegate) throw new Error(`No stream handler registered for API ${attempt.model.api}.`);
715
- const inner = attemptDelegate(attempt.model, context, attemptOptions);
715
+ const inner = await attemptDelegate(attempt.model, context, attemptOptions);
716
716
  for await (const event of inner) {
717
717
  if (!committed) {
718
718
  if (event.type === "error") {