Class AiTools

java.lang.Object
com.tnsai.tools.ai.AiTools

public class AiTools extends Object
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:

MethodBackendAuth
imageAnalyze(java.lang.String, java.lang.String)Gemini 2.0 Flash generateContentGEMINI_API_KEY
Since:
0.5.7 (Phase 2 batch 11 — built-in tool migration to function shape, see #188)
  • Constructor Details

    • AiTools

      public AiTools()
      Default constructor — picks GEMINI_API_KEY from env.
    • AiTools

      public AiTools(String geminiApiKey)
      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