File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ async function generateContent(
2424 projectId = GOOGLE_CLOUD_PROJECT ,
2525 location = GOOGLE_CLOUD_LOCATION
2626) {
27- const ai = new GoogleGenAI ( {
27+ const client = new GoogleGenAI ( {
2828 vertexai : true ,
2929 project : projectId ,
3030 location : location ,
@@ -59,7 +59,7 @@ async function generateContent(
5959 } ,
6060 ] ;
6161
62- const contentCache = await ai . caches . create ( {
62+ const contentCache = await client . caches . create ( {
6363 model : 'gemini-2.5-flash' ,
6464 config : {
6565 contents : contents ,
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ async function generateContent(
2525 location = GOOGLE_CLOUD_LOCATION ,
2626 cacheName = 'example-cache'
2727) {
28- const ai = new GoogleGenAI ( {
28+ const client = new GoogleGenAI ( {
2929 vertexai : true ,
3030 project : projectId ,
3131 location : location ,
@@ -35,7 +35,7 @@ async function generateContent(
3535 } ) ;
3636
3737 console . log ( 'Removing cache' ) ;
38- const contentCache = await ai . caches . delete ( {
38+ const contentCache = await client . caches . delete ( {
3939 name : cacheName ,
4040 } ) ;
4141
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ async function generateContent(
2424 projectId = GOOGLE_CLOUD_PROJECT ,
2525 location = GOOGLE_CLOUD_LOCATION
2626) {
27- const ai = new GoogleGenAI ( {
27+ const client = new GoogleGenAI ( {
2828 vertexai : true ,
2929 project : projectId ,
3030 location : location ,
@@ -33,7 +33,7 @@ async function generateContent(
3333 } ,
3434 } ) ;
3535
36- const contentCacheList = await ai . caches . list ( ) ;
36+ const contentCacheList = await client . caches . list ( ) ;
3737
3838 // Access individual properties of a ContentCache object(s)
3939 const contentCacheNames = [ ] ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ async function generateContent(
2626 location = GOOGLE_CLOUD_LOCATION ,
2727 cacheName = 'example-cache'
2828) {
29- const ai = new GoogleGenAI ( {
29+ const client = new GoogleGenAI ( {
3030 vertexai : true ,
3131 project : projectId ,
3232 location : location ,
@@ -35,13 +35,13 @@ async function generateContent(
3535 } ,
3636 } ) ;
3737
38- let contentCache = await ai . caches . get ( {
38+ let contentCache = await client . caches . get ( {
3939 name : cacheName ,
4040 } ) ;
4141
4242 console . log ( 'Expire time' , contentCache . expireTime ) ;
4343
44- contentCache = await ai . caches . update ( {
44+ contentCache = await client . caches . update ( {
4545 name : cacheName ,
4646 config : {
4747 ttl : '36000s' ,
@@ -58,7 +58,7 @@ async function generateContent(
5858 const nextWeekUtc = DateTime . utc ( ) . plus ( { days : 7 } ) ;
5959 console . log ( 'Next week (UTC):' , nextWeekUtc . toISO ( ) ) ;
6060
61- contentCache = await ai . caches . update ( {
61+ contentCache = await client . caches . update ( {
6262 name : cacheName ,
6363 config : {
6464 expireTime : nextWeekUtc ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ async function generateContent(
2626 location = GOOGLE_CLOUD_LOCATION ,
2727 cacheName = 'example-cache'
2828) {
29- const ai = new GoogleGenAI ( {
29+ const client = new GoogleGenAI ( {
3030 vertexai : true ,
3131 project : projectId ,
3232 location : location ,
@@ -35,7 +35,7 @@ async function generateContent(
3535 } ,
3636 } ) ;
3737
38- const response = await ai . models . generateContent ( {
38+ const response = await client . models . generateContent ( {
3939 model : 'gemini-2.5-flash' ,
4040 contents : 'Summarize the pdfs' ,
4141 config : {
You can’t perform that action at this time.
0 commit comments