Package com.t4a.api
Class JavaActionExecutor
java.lang.Object
com.t4a.api.JavaActionExecutor
- All Implemented Interfaces:
AIActionExecutor
- Direct Known Subclasses:
JavaClassExecutor
,JavaMethodExecutor
This is the base class for all the java based executors with common functionality
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.cloud.vertexai.api.Schema
Create schema from single propertyprotected com.google.cloud.vertexai.api.Schema
protected com.google.cloud.vertexai.api.Schema
getBuildForJson
(Map<String, Object> mapOfMapsForJason) Create Gemini Schema object this will be used to create funcitonprotected 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
protected abstract com.google.gson.Gson
getGson()
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 callgetPropertyValuesMap
(String responseFromAI) getPropertyValuesMapMap
(com.google.cloud.vertexai.api.GenerateContentResponse response) com.google.cloud.vertexai.api.Schema
mapClassToFun
(String className, String funName, String discription) com.google.cloud.vertexai.api.Type
Map Java type to Gemini typecom.google.cloud.vertexai.api.Type
Map String to Gemini typecom.google.cloud.vertexai.api.Type
mapTypeForPojo
(Class<?> type) protobufToMap
(Map<String, com.google.protobuf.Value> protobufMap)
-
Constructor Details
-
JavaActionExecutor
public JavaActionExecutor()
-
-
Method Details
-
mapType
Map Java type to Gemini type- Parameters:
type
-- Returns:
-
mapTypeForPojo
-
mapType
Map String to Gemini type- Parameters:
type
-- Returns:
-
mapClassToFun
public com.google.cloud.vertexai.api.Schema mapClassToFun(String className, String funName, String discription) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
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
-
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
-
protobufToMap
-
getPropertyValuesMapMap
-
getPropertyValuesMap
-
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
-
getGson
protected abstract com.google.gson.Gson getGson()
-