File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,6 +185,7 @@ export namespace Provider {
185185 source,
186186 info,
187187 options,
188+ getModel,
188189 }
189190 return
190191 }
Original file line number Diff line number Diff line change @@ -20,6 +20,19 @@ export namespace ProviderTransform {
2020 }
2121 }
2222 }
23+ if ( providerID === "amazon-bedrock" || modelID . includes ( "anthropic" ) ) {
24+ const system = msgs . filter ( ( msg ) => msg . role === "system" ) . slice ( 0 , 2 )
25+ const final = msgs . filter ( ( msg ) => msg . role !== "system" ) . slice ( - 2 )
26+
27+ for ( const msg of unique ( [ ...system , ...final ] ) ) {
28+ msg . providerMetadata = {
29+ ...msg . providerMetadata ,
30+ bedrock : {
31+ cachePoint : { type : "ephemeral" } ,
32+ } ,
33+ }
34+ }
35+ }
2336 return msgs
2437 }
2538}
Original file line number Diff line number Diff line change @@ -882,8 +882,12 @@ export namespace Session {
882882 reasoning : 0 ,
883883 cache : {
884884 write : ( metadata ?. [ "anthropic" ] ?. [ "cacheCreationInputTokens" ] ??
885+ // @ts -expect-error
886+ metadata ?. [ "bedrock" ] ?. [ "usage" ] ?. [ "cacheWriteInputTokens" ] ??
885887 0 ) as number ,
886888 read : ( metadata ?. [ "anthropic" ] ?. [ "cacheReadInputTokens" ] ??
889+ // @ts -expect-error
890+ metadata ?. [ "bedrock" ] ?. [ "usage" ] ?. [ "cacheReadInputTokens" ] ??
887891 0 ) as number ,
888892 } ,
889893 }
You can’t perform that action at this time.
0 commit comments