@@ -193,8 +193,8 @@ describe('AtlasServiceMain', function () {
193193 } ) ;
194194 } ) ;
195195
196- describe ( 'getQueryFromUserPrompt ' , function ( ) {
197- it ( 'makes a post request with the user prompt to the endpoint in the environment' , async function ( ) {
196+ describe ( 'getQueryFromUserInput ' , function ( ) {
197+ it ( 'makes a post request with the user input to the endpoint in the environment' , async function ( ) {
198198 AtlasService [ 'fetch' ] = sandbox . stub ( ) . resolves ( {
199199 ok : true ,
200200 json ( ) {
@@ -204,8 +204,8 @@ describe('AtlasServiceMain', function () {
204204 } ,
205205 } ) as any ;
206206
207- const res = await AtlasService . getQueryFromUserPrompt ( {
208- userPrompt : 'test' ,
207+ const res = await AtlasService . getQueryFromUserInput ( {
208+ userInput : 'test' ,
209209 signal : new AbortController ( ) . signal ,
210210 collectionName : 'jam' ,
211211 databaseName : 'peanut' ,
@@ -220,7 +220,7 @@ describe('AtlasServiceMain', function () {
220220 expect ( AtlasService [ 'fetch' ] ) . to . have . been . calledOnce ;
221221 expect ( args [ 0 ] ) . to . eq ( 'http://example.com/ai/api/v1/mql-query' ) ;
222222 expect ( args [ 1 ] . body ) . to . eq (
223- '{"userPrompt ":"test","collectionName":"jam","databaseName":"peanut","schema":{"_id":{"types":[{"bsonType":"ObjectId"}]}},"sampleDocuments":[{"_id":1234}]}'
223+ '{"userInput ":"test","collectionName":"jam","databaseName":"peanut","schema":{"_id":{"types":[{"bsonType":"ObjectId"}]}},"sampleDocuments":[{"_id":1234}]}'
224224 ) ;
225225 expect ( res ) . to . have . nested . property (
226226 'content.query.find.test' ,
@@ -232,27 +232,27 @@ describe('AtlasServiceMain', function () {
232232 const c = new AbortController ( ) ;
233233 c . abort ( ) ;
234234 try {
235- await AtlasService . getQueryFromUserPrompt ( {
235+ await AtlasService . getQueryFromUserInput ( {
236236 signal : c . signal ,
237- userPrompt : 'test' ,
237+ userInput : 'test' ,
238238 collectionName : 'test' ,
239239 databaseName : 'peanut' ,
240240 } ) ;
241- expect . fail ( 'Expected getQueryFromUserPrompt to throw' ) ;
241+ expect . fail ( 'Expected getQueryFromUserInput to throw' ) ;
242242 } catch ( err ) {
243243 expect ( err ) . to . have . property ( 'message' , 'This operation was aborted' ) ;
244244 }
245245 } ) ;
246246
247247 it ( 'throws if the request would be too much for the ai' , async function ( ) {
248248 try {
249- await AtlasService . getQueryFromUserPrompt ( {
250- userPrompt : 'test' ,
249+ await AtlasService . getQueryFromUserInput ( {
250+ userInput : 'test' ,
251251 collectionName : 'test' ,
252252 databaseName : 'peanut' ,
253253 sampleDocuments : [ { test : '4' . repeat ( 60000 ) } ] ,
254254 } ) ;
255- expect . fail ( 'Expected getQueryFromUserPrompt to throw' ) ;
255+ expect . fail ( 'Expected getQueryFromUserInput to throw' ) ;
256256 } catch ( err ) {
257257 expect ( err ) . to . have . property (
258258 'message' ,
@@ -269,8 +269,8 @@ describe('AtlasServiceMain', function () {
269269 } ,
270270 } ) as any ;
271271
272- await AtlasService . getQueryFromUserPrompt ( {
273- userPrompt : 'test' ,
272+ await AtlasService . getQueryFromUserInput ( {
273+ userInput : 'test' ,
274274 collectionName : 'test.test' ,
275275 databaseName : 'peanut' ,
276276 sampleDocuments : [
@@ -287,7 +287,7 @@ describe('AtlasServiceMain', function () {
287287
288288 expect ( AtlasService [ 'fetch' ] ) . to . have . been . calledOnce ;
289289 expect ( args [ 1 ] . body ) . to . eq (
290- '{"userPrompt ":"test","collectionName":"test.test","databaseName":"peanut","sampleDocuments":[{"a":"1"}]}'
290+ '{"userInput ":"test","collectionName":"test.test","databaseName":"peanut","sampleDocuments":[{"a":"1"}]}'
291291 ) ;
292292 } ) ;
293293
@@ -299,12 +299,12 @@ describe('AtlasServiceMain', function () {
299299 } ) as any ;
300300
301301 try {
302- await AtlasService . getQueryFromUserPrompt ( {
303- userPrompt : 'test' ,
302+ await AtlasService . getQueryFromUserInput ( {
303+ userInput : 'test' ,
304304 collectionName : 'test.test' ,
305305 databaseName : 'peanut' ,
306306 } ) ;
307- expect . fail ( 'Expected getQueryFromUserPrompt to throw' ) ;
307+ expect . fail ( 'Expected getQueryFromUserInput to throw' ) ;
308308 } catch ( err ) {
309309 expect ( err ) . to . have . property ( 'message' , '500 Internal Server Error' ) ;
310310 }
@@ -314,8 +314,8 @@ describe('AtlasServiceMain', function () {
314314 delete process . env . COMPASS_ATLAS_SERVICE_BASE_URL ;
315315
316316 try {
317- await AtlasService . getQueryFromUserPrompt ( {
318- userPrompt : 'test' ,
317+ await AtlasService . getQueryFromUserInput ( {
318+ userInput : 'test' ,
319319 collectionName : 'test.test' ,
320320 databaseName : 'peanut' ,
321321 } ) ;
@@ -337,8 +337,8 @@ describe('AtlasServiceMain', function () {
337337 } ) as any ;
338338 AtlasService [ 'oidcPluginSyncedFromLoggerState' ] = 'expired' ;
339339 const [ query ] = await Promise . all ( [
340- AtlasService . getQueryFromUserPrompt ( {
341- userPrompt : 'test' ,
340+ AtlasService . getQueryFromUserInput ( {
341+ userInput : 'test' ,
342342 collectionName : 'test' ,
343343 databaseName : 'test' ,
344344 sampleDocuments : [ ] ,
0 commit comments