Package com.t4a.api

Class JavaActionExecutor

java.lang.Object
com.t4a.api.JavaActionExecutor
All Implemented Interfaces:
AIActionExecutor
Direct Known Subclasses:
JavaClassExecutor, JavaMethodExecutor

public abstract class JavaActionExecutor extends Object implements AIActionExecutor
This is the base class for all the java based executors with common functionality
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.google.cloud.vertexai.api.Schema
    getBuild(com.google.cloud.vertexai.api.Type type, String property)
    Create schema from single property
    protected com.google.cloud.vertexai.api.Schema
    getBuild(Map<String,com.google.cloud.vertexai.api.Type> properties)
     
    protected com.google.cloud.vertexai.api.Schema
    getBuildForJson(Map<String,Object> mapOfMapsForJason)
    Create Gemini Schema object this will be used to create funciton
    protected com.google.cloud.vertexai.api.FunctionDeclaration
    getBuildFunction(String funName, String discription)
    Create function from the funciton name and discription , this is the main method behind all the magic it builds based on the properties which are initially created using properties, this properties are created by the subclasses by mapping the method or java class.
    protected com.google.cloud.vertexai.api.FunctionDeclaration
    getBuildFunction(Map<String,Object> mapOfMapsForJason, String funName, String discription)
     
    protected abstract com.google.gson.Gson
     
    protected abstract Map<String,com.google.cloud.vertexai.api.Type>
     
    getPropertyValuesJsonString(com.google.cloud.vertexai.api.GenerateContentResponse response)
     
    getPropertyValuesJsonString(com.google.cloud.vertexai.api.GenerateContentResponse response, boolean asIs)
     
    getPropertyValuesMap(com.google.cloud.vertexai.api.GenerateContentResponse response)
    Fetches the values populated by gemini into the function , this will get mapped to a MAP which can then converted to json or invoke method or make http call
    getPropertyValuesMapMap(com.google.cloud.vertexai.api.GenerateContentResponse response)
     
    com.google.cloud.vertexai.api.Type
    mapType(Class<?> type)
    Map Java type to Gemini type
    com.google.cloud.vertexai.api.Type
    Map String to Gemini type
    protobufToMap(Map<String,com.google.protobuf.Value> protobufMap)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JavaActionExecutor

      public JavaActionExecutor()
  • Method Details

    • mapType

      public com.google.cloud.vertexai.api.Type mapType(Class<?> type)
      Map Java type to Gemini type
      Parameters:
      type -
      Returns:
    • mapType

      public com.google.cloud.vertexai.api.Type mapType(String type)
      Map String to Gemini type
      Parameters:
      type -
      Returns:
    • getBuildForJson

      protected com.google.cloud.vertexai.api.Schema getBuildForJson(Map<String,Object> mapOfMapsForJason)
      Create Gemini Schema object this will be used to create funciton
      Returns:
    • getBuild

      protected com.google.cloud.vertexai.api.Schema getBuild(Map<String,com.google.cloud.vertexai.api.Type> properties)
    • getBuild

      protected com.google.cloud.vertexai.api.Schema getBuild(com.google.cloud.vertexai.api.Type type, String property)
      Create schema from single property
      Parameters:
      type -
      property -
      Returns:
    • getBuildFunction

      protected com.google.cloud.vertexai.api.FunctionDeclaration getBuildFunction(String funName, String discription)
      Create function from the funciton name and discription , this is the main method behind all the magic it builds based on the properties which are initially created using properties, this properties are created by the subclasses by mapping the method or java class. Any subclass has to populate the properties map object
      Parameters:
      funName -
      discription -
      Returns:
    • getBuildFunction

      protected com.google.cloud.vertexai.api.FunctionDeclaration getBuildFunction(Map<String,Object> mapOfMapsForJason, String funName, String discription)
    • protobufToMap

      public Map<String,Object> protobufToMap(Map<String,com.google.protobuf.Value> protobufMap)
    • getPropertyValuesMapMap

      public Map<String,Object> getPropertyValuesMapMap(com.google.cloud.vertexai.api.GenerateContentResponse response)
    • getPropertyValuesMap

      public Map<String,Object> getPropertyValuesMap(com.google.cloud.vertexai.api.GenerateContentResponse response)
      Fetches the values populated by gemini into the function , this will get mapped to a MAP which can then converted to json or invoke method or make http call
      Parameters:
      response -
      Returns:
    • getPropertyValuesJsonString

      public String getPropertyValuesJsonString(com.google.cloud.vertexai.api.GenerateContentResponse response)
    • getPropertyValuesJsonString

      public String getPropertyValuesJsonString(com.google.cloud.vertexai.api.GenerateContentResponse response, boolean asIs)
    • getProperties

      protected abstract Map<String,com.google.cloud.vertexai.api.Type> getProperties()
    • getGson

      protected abstract com.google.gson.Gson getGson()