@providerprotocol/ai 0.0.31 → 0.0.32

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.
@@ -1,4 +1,4 @@
1
- import { P as Provider } from '../llm-DgDEy9il.js';
1
+ import { P as Provider } from '../llm-BQJZj3cD.js';
2
2
 
3
3
  /**
4
4
  * OpenRouter-specific types for the Unified Provider Protocol.
@@ -2,8 +2,9 @@ import {
2
2
  parseJsonResponse
3
3
  } from "../chunk-3C7O2RNO.js";
4
4
  import {
5
- StreamEventType
6
- } from "../chunk-73IIE3QT.js";
5
+ StreamEventType,
6
+ objectDelta
7
+ } from "../chunk-6S222DHN.js";
7
8
  import {
8
9
  AssistantMessage,
9
10
  createProvider,
@@ -758,7 +759,11 @@ function createCompletionsLLMHandler() {
758
759
  }
759
760
  const uppEvents = transformStreamEvent(chunk, state);
760
761
  for (const event of uppEvents) {
761
- yield event;
762
+ if (request.structure && event.type === StreamEventType.TextDelta) {
763
+ yield objectDelta(event.delta.text ?? "", event.index);
764
+ } else {
765
+ yield event;
766
+ }
762
767
  }
763
768
  }
764
769
  }
@@ -1667,7 +1672,11 @@ function createResponsesLLMHandler() {
1667
1672
  }
1668
1673
  const uppEvents = transformStreamEvent2(event, state);
1669
1674
  for (const uppEvent of uppEvents) {
1670
- yield uppEvent;
1675
+ if (request.structure && uppEvent.type === StreamEventType.TextDelta) {
1676
+ yield objectDelta(uppEvent.delta.text ?? "", uppEvent.index);
1677
+ } else {
1678
+ yield uppEvent;
1679
+ }
1671
1680
  }
1672
1681
  }
1673
1682
  }