JSPM

  • Created
  • Published
  • Downloads 74
  • Score
    100M100P100Q88923F
  • License MIT

Google AI adapter for Agentick

Package Exports

  • @agentick/google
  • @agentick/google/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@agentick/google) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@agentick/google

Google AI / Vertex AI adapter for Agentick.

Installation

pnpm add @agentick/google

Usage

import { google } from "@agentick/google";
import { createApp } from "@agentick/core";

// Google AI Studio
const model = google({
  apiKey: process.env.GOOGLE_API_KEY,
  model: "gemini-2.0-flash",
});

// Use with createApp
const app = createApp(MyAgent, { model });
const session = await app.session();
await session.run({ messages: [{ role: "user", content: [{ type: "text", text: "Hello!" }] }] });

// Or use as JSX component
function MyAgent() {
  return (
    <model temperature={0.7}>
      <System>You are helpful.</System>
      <Timeline />
    </model>
  );
}

// Or call directly
const result = await model.generate({
  messages: [{ role: "user", content: "Hello!" }],
});

Vertex AI

const model = google({
  vertexai: true,
  project: process.env.GCP_PROJECT_ID,
  location: "us-central1",
  model: "gemini-2.0-flash",
  googleAuthOptions: {
    credentials: JSON.parse(process.env.GCP_CREDENTIALS),
  },
});

JSX Component Pattern

import { GoogleModel } from "@agentick/google";

function MyAgent() {
  return (
    <GoogleModel apiKey={process.env.GOOGLE_API_KEY} model="gemini-2.0-flash" temperature={0.7}>
      <System>You are helpful.</System>
      <Timeline />
    </GoogleModel>
  );
}

Configuration

Option Type Description
model string Model name (e.g., gemini-2.0-flash)
apiKey string? Google AI Studio API key
vertexai boolean? Use Vertex AI instead
project string? GCP project ID (Vertex)
location string? GCP region (Vertex)
googleAuthOptions object? Auth options (Vertex)
temperature number? Sampling temperature
maxTokens number? Maximum tokens to generate

Exports

  • google(config) - Factory function returning ModelClass
  • createGoogleModel(config) - Same as google()
  • GoogleModel - JSX component for declarative usage