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-agent
The wizard will walk you through:
- Installing required packages (e.g., [email protected])
- 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({
model: "chatgpt",
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, "chatgpt">(),
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
GoogleImageService
connector. - 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-key
Make 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! ๐