@@ -74,7 +74,7 @@ describeWithEnvironment('AiAgent', () => {
7474 aidaClient : { } as Host . AidaClient . AidaClient ,
7575 } ) ;
7676 assert . strictEqual (
77- agent . buildRequest ( { input : 'test input' } ) . options ?. temperature ,
77+ agent . buildRequest ( { text : 'test input' } ) . options ?. temperature ,
7878 1 ,
7979 ) ;
8080 } ) ;
@@ -85,7 +85,7 @@ describeWithEnvironment('AiAgent', () => {
8585 } ) ;
8686 agent . options . temperature = - 1 ;
8787 assert . strictEqual (
88- agent . buildRequest ( { input : 'test input' } ) . options ?. temperature ,
88+ agent . buildRequest ( { text : 'test input' } ) . options ?. temperature ,
8989 undefined ,
9090 ) ;
9191 } ) ;
@@ -95,7 +95,7 @@ describeWithEnvironment('AiAgent', () => {
9595 aidaClient : { } as Host . AidaClient . AidaClient ,
9696 } ) ;
9797 assert . strictEqual (
98- agent . buildRequest ( { input : 'test input' } ) . options ?. model_id ,
98+ agent . buildRequest ( { text : 'test input' } ) . options ?. model_id ,
9999 'test model' ,
100100 ) ;
101101 } ) ;
@@ -106,7 +106,7 @@ describeWithEnvironment('AiAgent', () => {
106106 serverSideLoggingEnabled : true ,
107107 } ) ;
108108 assert . strictEqual (
109- agent . buildRequest ( { input : 'test input' } ) . metadata ?. disable_user_content_logging ,
109+ agent . buildRequest ( { text : 'test input' } ) . metadata ?. disable_user_content_logging ,
110110 false ,
111111 ) ;
112112 } ) ;
@@ -119,7 +119,7 @@ describeWithEnvironment('AiAgent', () => {
119119 assert . strictEqual (
120120 agent
121121 . buildRequest ( {
122- input : 'test input' ,
122+ text : 'test input' ,
123123 } )
124124 . metadata ?. disable_user_content_logging ,
125125 true ,
@@ -131,27 +131,27 @@ describeWithEnvironment('AiAgent', () => {
131131 aidaClient : { } as Host . AidaClient . AidaClient ,
132132 serverSideLoggingEnabled : false ,
133133 } ) ;
134- const request = agent . buildRequest ( { input : 'test input' } ) ;
135- assert . strictEqual ( request . input , 'test input' ) ;
136- assert . strictEqual ( request . chat_history , undefined ) ;
134+ const request = agent . buildRequest ( { text : 'test input' } ) ;
135+ assert . strictEqual ( request . current_message ?. parts [ 0 ] . text , 'test input' ) ;
136+ assert . strictEqual ( request . historical_contexts , undefined ) ;
137137 } ) ;
138138
139139 it ( 'builds a request with a sessionId' , async ( ) => {
140140 const agent = new AiAgentMock ( {
141141 aidaClient : { } as Host . AidaClient . AidaClient ,
142142 } ) ;
143- const request = agent . buildRequest ( { input : 'test input' } ) ;
143+ const request = agent . buildRequest ( { text : 'test input' } ) ;
144144 assert . strictEqual ( request . metadata ?. string_session_id , 'sessionId' ) ;
145145 } ) ;
146146
147147 it ( 'builds a request with preamble' , async ( ) => {
148148 const agent = new AiAgentMock ( {
149149 aidaClient : { } as Host . AidaClient . AidaClient ,
150150 } ) ;
151- const request = agent . buildRequest ( { input : 'test input' } ) ;
152- assert . strictEqual ( request . input , 'test input' ) ;
151+ const request = agent . buildRequest ( { text : 'test input' } ) ;
152+ assert . strictEqual ( request . current_message ?. parts [ 0 ] . text , 'test input' ) ;
153153 assert . strictEqual ( request . preamble , 'preamble' ) ;
154- assert . strictEqual ( request . chat_history , undefined ) ;
154+ assert . strictEqual ( request . historical_contexts , undefined ) ;
155155 } ) ;
156156
157157 it ( 'builds a request with chat history' , async ( ) => {
@@ -190,26 +190,24 @@ describeWithEnvironment('AiAgent', () => {
190190 text : 'answer' ,
191191 } ,
192192 ] ;
193- const request = agent . buildRequest ( {
194- input : 'test input' ,
195- } ) ;
196- assert . strictEqual ( request . input , 'test input' ) ;
197- assert . deepStrictEqual ( request . chat_history , [
193+ const request = agent . buildRequest ( { text : 'test input' } ) ;
194+ assert . strictEqual ( request . current_message ?. parts [ 0 ] . text , 'test input' ) ;
195+ assert . deepStrictEqual ( request . historical_contexts , [
198196 {
199- text : 'test' ,
200- entity : 1 ,
197+ parts : [ { text : 'test' } ] ,
198+ role : 1 ,
201199 } ,
202200 {
203- entity : 2 ,
204- text : 'THOUGHT: thought\nTITLE: title\nACTION\naction\nSTOP' ,
201+ role : 2 ,
202+ parts : [ { text : 'THOUGHT: thought\nTITLE: title\nACTION\naction\nSTOP' } ] ,
205203 } ,
206204 {
207- entity : 1 ,
208- text : 'OBSERVATION: result' ,
205+ role : 1 ,
206+ parts : [ { text : 'OBSERVATION: result' } ] ,
209207 } ,
210208 {
211- entity : 2 ,
212- text : 'answer' ,
209+ role : 2 ,
210+ parts : [ { text : 'answer' } ] ,
213211 } ,
214212 ] ) ;
215213 } ) ;
@@ -240,11 +238,9 @@ describeWithEnvironment('AiAgent', () => {
240238 error : ErrorType . ABORT ,
241239 } ,
242240 ] ;
243- const request = agent . buildRequest ( {
244- input : 'test input' ,
245- } ) ;
246- assert . strictEqual ( request . input , 'test input' ) ;
247- assert . deepStrictEqual ( request . chat_history , undefined ) ;
241+ const request = agent . buildRequest ( { text : 'test input' } ) ;
242+ assert . strictEqual ( request . current_message ?. parts [ 0 ] . text , 'test input' ) ;
243+ assert . deepStrictEqual ( request . historical_contexts , undefined ) ;
248244 } ) ;
249245
250246 it ( 'builds a request with aborted query in history before a real request' , async ( ) => {
@@ -303,26 +299,24 @@ describeWithEnvironment('AiAgent', () => {
303299 text : 'answer2' ,
304300 } ,
305301 ] ;
306- const request = agent . buildRequest ( {
307- input : 'test input' ,
308- } ) ;
309- assert . strictEqual ( request . input , 'test input' ) ;
310- assert . deepStrictEqual ( request . chat_history , [
302+ const request = agent . buildRequest ( { text : 'test input' } ) ;
303+ assert . strictEqual ( request . current_message ?. parts [ 0 ] . text , 'test input' ) ;
304+ assert . deepStrictEqual ( request . historical_contexts , [
311305 {
312- text : 'test2' ,
313- entity : 1 ,
306+ parts : [ { text : 'test2' } ] ,
307+ role : 1 ,
314308 } ,
315309 {
316- entity : 2 ,
317- text : 'THOUGHT: thought2\nTITLE: title2\nACTION\naction2\nSTOP' ,
310+ role : 2 ,
311+ parts : [ { text : 'THOUGHT: thought2\nTITLE: title2\nACTION\naction2\nSTOP' } ] ,
318312 } ,
319313 {
320- entity : 1 ,
321- text : 'OBSERVATION: result2' ,
314+ role : 1 ,
315+ parts : [ { text : 'OBSERVATION: result2' } ] ,
322316 } ,
323317 {
324- entity : 2 ,
325- text : 'answer2' ,
318+ role : 2 ,
319+ parts : [ { text : 'answer2' } ] ,
326320 } ,
327321 ] ) ;
328322 } ) ;
@@ -395,12 +389,12 @@ describeWithEnvironment('AiAgent', () => {
395389
396390 assert . deepStrictEqual ( agent . chatHistoryForTesting , [
397391 {
398- entity : Host . AidaClient . Entity . USER ,
399- text : 'query' ,
392+ role : Host . AidaClient . Role . USER ,
393+ parts : [ { text : 'query' } ] ,
400394 } ,
401395 {
402- entity : Host . AidaClient . Entity . SYSTEM ,
403- text : 'Partial answer is now completed' ,
396+ role : Host . AidaClient . Role . MODEL ,
397+ parts : [ { text : 'Partial answer is now completed' } ] ,
404398 } ,
405399 ] ) ;
406400 } ) ;
0 commit comments