Class AntsVertexAI
java.lang.Object
com.ants.platform.guardrails.providers.AntsVertexAI
Google Vertex AI (Gemini) wrapper with guardrail enforcement and trace logging.
Uses the Vertex AI REST API with Application Default Credentials (ADC).
The access token is obtained via gcloud auth print-access-token or
can be provided directly via the builder.
var client = AntsVertexAI.builder()
.projectId("my-gcp-project")
.location("us-central1")
.antsApiKey("pk:sk")
.agentId("agent_123")
.build();
JsonNode response = client.generateContent(
"gemini-2.0-flash",
List.of(Map.of("role", "user", "content", "Hello"))
);
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic AntsVertexAI.Builderbuilder()com.fasterxml.jackson.databind.JsonNodeGenerate content using Vertex AI with guardrail checks.
-
Method Details
-
builder
-
generateContent
public com.fasterxml.jackson.databind.JsonNode generateContent(String model, List<Map<String, String>> messages) Generate content using Vertex AI with guardrail checks. A trace is logged asynchronously after each call.- Parameters:
model- Gemini model ID (e.g. "gemini-2.0-flash")messages- list of message maps with "role" and "content" keys- Returns:
- raw JSON response from the Vertex AI generateContent API
-