# v8: Gemini| \ p tL X t  Vertex AI D D̈. t 줸 Gemini xD X Freee 8( p D <\ tL\ XX u 0D li. | , "Amazon Web Services  3,503"t| p t, AI <\ ""  "D"\ Xt . ## 1: tL X < ` tL| Xi. `src/vertexAiClient.ts` i: ```typescript // src/vertexAiClient.ts // p tL X const CATEGORIES = [ 'D', 'PD', 'D', '4', '', 'xtD', ' D', 'D', '', '0' ]; ``` t tL@ |x X 0 0| X => { try { const prompt = ` L p D X \ tL X t8. p : - : ${deal.issue_date} - : ${deal.type === 'income' ? '' : ''} - a: ${deal.amount} -  ID: ${deal.partner_id || 'L'} - $: ${deal.ref_number || 'L'} \ tL: ${CATEGORIES.join(', ')} L <\ t8: tL: [ \ tL] `.trim(); const result = await model.generateContent(prompt); const response = result.response; const text = response.candidates?.[0]?.content?.parts?.[0]?.text || ''; // Q tL const categoryMatch = text.match(/tL:\s*(.+)/); if (categoryMatch && categoryMatch[1]) { const category = categoryMatch[1].trim(); // X tL  Xx Ux if (CATEGORIES.includes(category)) { return category; } } // 0 tL console.log(` tL| X . Q: ${text}`); return '0'; } catch (error: any) { console.error('L Vertex AI tL X (:', error.message); return '0'; } }; ``` ## 3: 0X h l p| \ X, API \D $X t| i: ```typescript // src/vertexAiClient.ts export const classifyTransactionsBatch = async (deals: any[]): Promise> => { const categories = new Map(); console.log(` Vertex AI\ ${deals.length}X p X ...`); for (let i = 0; i < deals.length; i++) { const deal = deals[i]; const category = await classifyTransaction(deal); categories.set(deal.id, category); // ĉ i \ if ((i + 1) % 5 === 0 || i === deals.length - 1) { console.log(` ĉ: ${i + 1}/${deals.length}`); } // API \ ) (500ms t) if (i < deals.length - 1) { await new Promise(resolve => setTimeout(resolve, 500)); } } return categories; }; ``` ## 4: L l 1 Vertex AI X 0 LX0 \ l| : ```typescript // src/testVertexAI.ts import { getDeals } from './freeeClient'; import { classifyTransactionsBatch } from './vertexAiClient'; const main = async () => { console.log('> Vertex AI tL X L...\n'); const companyId = parseInt(process.env.FREEE_BUSINESS_ID || '', 10); if (!companyId) { throw new Error('X  FREEE_BUSINESS_ID ,t $ JX.'); } // p` 0 $ (: t ) const today = new Date(); const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1); const startDate = firstDayOfMonth.toISOString().split('T')[0]; const endDate = today.toISOString().split('T')[0]; console.log(`= p 0: ${startDate} ~ ${endDate}\n`); try { // 1. Freee p 8$0 console.log('1 Freee API p p ...'); const deals = await getDeals(companyId, startDate, endDate); console.log(`  ${deals.length}X p D 8T.\n`); if (deals.length === 0) { console.log('L` p Ƶ.'); return; } // 2. Vertex AI\ tL X console.log('2 Vertex AI\ tL X ...'); const categories = await classifyTransactionsBatch(deals); console.log(`  ${categories.size}X p tL X D\n`); // X % console.log('= X :'); deals.forEach((deal: any, index: number) => { const category = categories.get(deal.id) || 'X'; console.log(` ${index + 1}. [${category}] ${deal.issue_date} - ${deal.amount}`); }); console.log('\n L D!'); } catch (error: any) { console.error('\nL $X :', error.message); if (error.stack) { console.error(error.stack); } throw error; } }; main().catch(error => { console.error('  $X :', error); process.exit(1); }); ``` ## 5: L L l| X AI X X Uxi: ```bash npx ts-node src/testVertexAI.ts ```  %: ``` > Vertex AI tL X L... = p 0: 2025-10-31 ~ 2025-11-27 1 Freee API p p ...  11X p D 8T. 2 Vertex AI\ tL X ... Vertex AI\ 11X p X ... ĉ: 5/11 ĉ: 10/11 ĉ: 11/11  11X p tL X D = X : 1. [0] 2025-11-22 - 2550 2. [0] 2025-11-22 - 18348 3. [0] 2025-11-20 - 2180 4. [0] 2025-11-14 - 4316 5. [] 2025-11-12 - 891 6. [0] 2025-11-10 - 1899 7. [0] 2025-11-09 - 23958 8. [] 2025-11-02 - 3503 9. [0] 2025-10-02 - 3216 10. [D] 2025-09-25 - 16680 11. [0] 2025-09-02 - 3343  L D! ``` ##  x  l  `  : 1. **l \T**: T lx | hX X U| |  2. ****: |\  $ t t X | 3. **0X API**: GeminiX 0X 0D X @ D \T 4. **$X **: $l $X API \ \ --- L **v9** 줸 X pt0| Google Sheets <\ X 0D lX.