@@ -86,7 +86,13 @@ describe('itemsToLanguageV1Messages', () => {
8686 const items : protocol . ModelItem [ ] = [
8787 {
8888 role : 'user' ,
89- content : [ { type : 'input_text' , text : 'hi' } ] ,
89+ content : [
90+ {
91+ type : 'input_text' ,
92+ text : 'hi' ,
93+ providerData : { test : { cacheControl : { type : 'ephemeral' } } } ,
94+ } ,
95+ ] ,
9096 } as any ,
9197 {
9298 type : 'function_call' ,
@@ -108,7 +114,13 @@ describe('itemsToLanguageV1Messages', () => {
108114 expect ( msgs ) . toEqual ( [
109115 {
110116 role : 'user' ,
111- content : [ { type : 'text' , text : 'hi' } ] ,
117+ content : [
118+ {
119+ type : 'text' ,
120+ text : 'hi' ,
121+ providerMetadata : { test : { cacheControl : { type : 'ephemeral' } } } ,
122+ } ,
123+ ] ,
112124 providerMetadata : { } ,
113125 } ,
114126 {
@@ -119,6 +131,7 @@ describe('itemsToLanguageV1Messages', () => {
119131 toolCallId : '1' ,
120132 toolName : 'foo' ,
121133 args : { } ,
134+ providerMetadata : { a : 1 } ,
122135 } ,
123136 ] ,
124137 providerMetadata : { a : 1 } ,
@@ -131,6 +144,7 @@ describe('itemsToLanguageV1Messages', () => {
131144 toolCallId : '1' ,
132145 toolName : 'foo' ,
133146 result : { type : 'output_text' , text : 'out' } ,
147+ providerMetadata : { b : 2 } ,
134148 } ,
135149 ] ,
136150 providerMetadata : { b : 2 } ,
@@ -173,15 +187,25 @@ describe('itemsToLanguageV1Messages', () => {
173187 {
174188 role : 'user' ,
175189 content : [
176- { type : 'text' , text : 'hi' } ,
177- { type : 'image' , image : new URL ( 'http://x/img' ) } ,
190+ { type : 'text' , text : 'hi' , providerMetadata : { } } ,
191+ {
192+ type : 'image' ,
193+ image : new URL ( 'http://x/img' ) ,
194+ providerMetadata : { } ,
195+ } ,
178196 ] ,
179197 providerMetadata : { } ,
180198 } ,
181199 {
182200 role : 'assistant' ,
183201 content : [
184- { type : 'tool-call' , toolCallId : '1' , toolName : 'do' , args : { } } ,
202+ {
203+ type : 'tool-call' ,
204+ toolCallId : '1' ,
205+ toolName : 'do' ,
206+ args : { } ,
207+ providerMetadata : { } ,
208+ } ,
185209 ] ,
186210 providerMetadata : { } ,
187211 } ,
@@ -193,13 +217,14 @@ describe('itemsToLanguageV1Messages', () => {
193217 toolCallId : '1' ,
194218 toolName : 'do' ,
195219 result : { type : 'output_text' , text : 'out' } ,
220+ providerMetadata : { } ,
196221 } ,
197222 ] ,
198223 providerMetadata : { } ,
199224 } ,
200225 {
201226 role : 'assistant' ,
202- content : [ { type : 'reasoning' , text : 'why' } ] ,
227+ content : [ { type : 'reasoning' , text : 'why' , providerMetadata : { } } ] ,
203228 providerMetadata : { } ,
204229 } ,
205230 ] ) ;
@@ -218,7 +243,7 @@ describe('itemsToLanguageV1Messages', () => {
218243 expect ( msgs ) . toEqual ( [
219244 {
220245 role : 'user' ,
221- content : [ { type : 'text' , text : 'hi' } ] ,
246+ content : [ { type : 'text' , text : 'hi' , providerMetadata : { } } ] ,
222247 providerMetadata : { } ,
223248 } ,
224249 ] ) ;
@@ -769,6 +794,8 @@ describe('AiSdkModel', () => {
769794 toolCallId : 'call1' ,
770795 toolName : 'do' ,
771796 args : { } ,
797+
798+ providerMetadata : { meta : 1 } ,
772799 } ,
773800 ] ,
774801 providerMetadata : { meta : 1 } ,
0 commit comments