Skip to content

Commit 26166ff

Browse files
authored
Merge pull request #949 from narengogi/fix/anthropic-streaming-error-chunk-parsing
fix: update logic for parsing errors while streaming in anthropic
2 parents 430b0cb + fee196b commit 26166ff

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/providers/anthropic/chatComplete.ts

+1
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ export const AnthropicChatCompleteStreamChunkTransform: (
485485
chunk = chunk.replace(/^event: content_block_start[\r\n]*/, '');
486486
chunk = chunk.replace(/^event: message_delta[\r\n]*/, '');
487487
chunk = chunk.replace(/^event: message_start[\r\n]*/, '');
488+
chunk = chunk.replace(/^event: error[\r\n]*/, '');
488489
chunk = chunk.replace(/^data: /, '');
489490
chunk = chunk.trim();
490491

src/providers/google-vertex-ai/chatComplete.ts

+1
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ export const VertexAnthropicChatCompleteStreamChunkTransform: (
988988
chunk = chunk.replace(/^event: content_block_start[\r\n]*/, '');
989989
chunk = chunk.replace(/^event: message_delta[\r\n]*/, '');
990990
chunk = chunk.replace(/^event: message_start[\r\n]*/, '');
991+
chunk = chunk.replace(/^event: error[\r\n]*/, '');
991992
chunk = chunk.replace(/^data: /, '');
992993
chunk = chunk.trim();
993994

0 commit comments

Comments
 (0)