Package com.tnsai.tools.ai
Class AiTools
java.lang.Object
com.tnsai.tools.ai.AiTools
Function-shape AI / multimodal tools — image analysis via Google Gemini
2.0 Flash. Replaces the legacy
ImageAnalysisTool.
The legacy VisionToCodeTool is intentionally NOT migrated: its
legacy implementation only returned a hardcoded template (it was never
wired up to a Vision LLM) and it wasn't even registered in
AiToolProvider. Per the "delete unused code completely" rule, it
goes away with the Phase-3 legacy sweep.
One typed @Tool method:
| Method | Backend | Auth |
|---|---|---|
imageAnalyze(java.lang.String, java.lang.String) | Gemini 2.0 Flash generateContent | GEMINI_API_KEY |
- Since:
- 0.5.7 (Phase 2 batch 11 — built-in tool migration to function shape, see #188)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
AiTools
public AiTools()Default constructor — picksGEMINI_API_KEYfrom env. -
AiTools
Explicit-key constructor. -
AiTools
public AiTools(String geminiApiKey, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP.
-
-
Method Details
-
imageAnalyze
@Tool(name="image_analyze", description="Analyze an image with Google\'s Gemini 2.0 Flash vision model. {source} is a local file path, an http(s) URL, or a base64 string prefixed with \"base64:\". Optional {question} narrows the analysis (e.g. \"extract all visible text\", \"is there a person here?\"). When {question} is blank, defaults to a full description. Returns the model\'s textual analysis. Requires GEMINI_API_KEY.", keywords={"image","analyze","vision","ocr","describe","multimodal","visual","gemini"}, idempotent=true) public String imageAnalyze(@ToolParam(description="Local file path, http(s) URL, or base64-encoded image with \"base64:\" prefix") String source, @ToolParam(description="Optional question or instruction; blank \u2192 full description",required=false,defaultValue="") String question) throws IOException - Throws:
IOException
-