Skip to main content

Example

import { Metorial } from 'metorial';
import { metorialGoogle } from '@metorial/google';
import { GoogleGenerativeAI } from '@google/generative-ai';

let metorial = new Metorial({ apiKey: process.env.METORIAL_API_KEY });
let genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);

await metorial.withProviderSession(
    metorialGoogle,
    { serverDeployments: [{ serverDeploymentId: 'your-deployment-id' }] },
    async ({ tools, closeSession }) => {
        let model = genAI.getGenerativeModel({
            model: 'gemini-pro',
            tools: tools
        });

        await closeSession();
    }
);