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 bridges will implement 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)
    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 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
    com.google.cloud.vertexai.api.Type
    mapType(Class<?> type)
    Map Java type to Gemini type
    com.google.cloud.vertexai.api.Type
     

    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)
    • getBuild

      protected com.google.cloud.vertexai.api.Schema getBuild(Map<String,com.google.cloud.vertexai.api.Type> properties)
      Create Gemini Schema object this will be used to create funciton
      Parameters:
      properties -
      Returns:
    • 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:
    • 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()