Introduction
- playgroundΒ You can see the demo code on the playground.
Set up a fully functional Google Image Agent powered by OpenAIβs GPT model in a flash using the Agentica CLI.
Quick CLI Setup
Start the Agentica Setup Wizard with this single command:
npx agentica start google-image-agentThe wizard will walk you through:
- Installing required packages (e.g., agentica@0.12.14)
- Choosing your package manager and project type
- Selecting the GOOGLE IMAGE controller
- Entering your
OPENAI_API_KEY
Once complete, Agentica automatically generates your code, creates a .env file, and installs all dependencies.
Generated Code Overview
The generated code looks like this:
import { Agentica } from "@agentica/core";
import typia from "typia";
import dotenv from "dotenv";
import { OpenAI } from "openai";
import { GoogleImageService } from "@wrtnlabs/connector-google-image";
dotenv.config();
export const agent = new Agentica({
vendor: {
api: new OpenAI({
apiKey: process.env.OPENAI_API_KEY!,
}),
model: "gpt-4o-mini",
},
controllers: [
{
name: "GoogleImage Connector",
protocol: "class",
application: typia.llm.application<GoogleImageService>(),
execute: new GoogleImageService(),
},
],
});
const main = async () => {
console.log(await agent.conversate("What can you do?"));
};
main();This code instantly sets up your Google Image Agent, ready to perform intelligent image searches on Google.
What This Does
Your Google Image Agent will:
- Process Google Image Data: Use the
GoogleImageServiceconnector. - Leverage OpenAIβs GPT Model: For smart image search queries.
- Maintain Type Safety: With
typia. - Securely Manage Credentials: Using environment variables via
dotenv.
Set up your environment variables in a .env file:
OPENAI_API_KEY=your-openai-api-key
SERP_API_KEY=your-serp-api-keyMake sure to include your SerpApi API key in the SERP_API_KEY field.
Use Case Example
Imagine asking the agent:
βFind the cute cat imageβ
The agent will search Google Images for a cute cat photo.
Available Functions
For a complete list of functions available in GoogleImageService, check out the source code:
π wrtnlabs/connectors - GoogleImageService.tsΒ
Your AI-powered Google Image Agent is now ready for seamless, automated image searches! π