@@ -32,37 +32,39 @@ const fakeVertexAI = {
32
32
globalThis . RNFB_VERTEXAI_EMULATOR_URL = true ;
33
33
34
34
// It calls firebase functions emulator that mimics responses from VertexAI server
35
- describe ( 'fetch requests()' , function ( ) {
36
- it ( 'should fetch' , async function ( ) {
37
- const model = getGenerativeModel ( fakeVertexAI , { model : 'gemini-1.5-flash' } ) ;
38
- const result = await model . generateContent ( "What is google's mission statement?" ) ;
39
- const text = result . response . text ( ) ;
40
- // See vertexAI function emulator for response
41
- text . should . containEql (
42
- 'Google\'s mission is to "organize the world\'s information and make it universally accessible and useful."' ,
43
- ) ;
44
- } ) ;
35
+ describe ( 'ai()' , function ( ) {
36
+ describe ( 'fetch requests' , function ( ) {
37
+ it ( 'should fetch' , async function ( ) {
38
+ const model = getGenerativeModel ( fakeVertexAI , { model : 'gemini-1.5-flash' } ) ;
39
+ const result = await model . generateContent ( "What is google's mission statement?" ) ;
40
+ const text = result . response . text ( ) ;
41
+ // See vertexAI function emulator for response
42
+ text . should . containEql (
43
+ 'Google\'s mission is to "organize the world\'s information and make it universally accessible and useful."' ,
44
+ ) ;
45
+ } ) ;
45
46
46
- it ( 'should fetch stream' , async function ( ) {
47
- const model = getGenerativeModel ( fakeVertexAI , { model : 'gemini-1.5-flash' } ) ;
48
- // See vertexAI function emulator for response
49
- const poem = [
50
- 'The wind whispers secrets through the trees,' ,
51
- 'Rustling leaves in a gentle breeze.' ,
52
- 'Sunlight dances on the grass,' ,
53
- 'A fleeting moment, sure to pass.' ,
54
- 'Birdsong fills the air so bright,' ,
55
- 'A symphony of pure delight.' ,
56
- 'Time stands still, a peaceful pause,' ,
57
- "In nature's beauty, no flaws." ,
58
- ] ;
59
- const result = await model . generateContentStream ( 'Write me a short poem' ) ;
47
+ it ( 'should fetch stream' , async function ( ) {
48
+ const model = getGenerativeModel ( fakeVertexAI , { model : 'gemini-1.5-flash' } ) ;
49
+ // See vertexAI function emulator for response
50
+ const poem = [
51
+ 'The wind whispers secrets through the trees,' ,
52
+ 'Rustling leaves in a gentle breeze.' ,
53
+ 'Sunlight dances on the grass,' ,
54
+ 'A fleeting moment, sure to pass.' ,
55
+ 'Birdsong fills the air so bright,' ,
56
+ 'A symphony of pure delight.' ,
57
+ 'Time stands still, a peaceful pause,' ,
58
+ "In nature's beauty, no flaws." ,
59
+ ] ;
60
+ const result = await model . generateContentStream ( 'Write me a short poem' ) ;
60
61
61
- const text = [ ] ;
62
- for await ( const chunk of result . stream ) {
63
- const chunkText = chunk . text ( ) ;
64
- text . push ( chunkText ) ;
65
- }
66
- text . should . deepEqual ( poem ) ;
62
+ const text = [ ] ;
63
+ for await ( const chunk of result . stream ) {
64
+ const chunkText = chunk . text ( ) ;
65
+ text . push ( chunkText ) ;
66
+ }
67
+ text . should . deepEqual ( poem ) ;
68
+ } ) ;
67
69
} ) ;
68
70
} ) ;
0 commit comments