Package com.t4a.bridge
Class JavaActionExecutor
java.lang.Object
com.t4a.bridge.JavaActionExecutor
- All Implemented Interfaces:
AIActionExecutor
- Direct Known Subclasses:
JavaClassExecutor
,JavaMethodExecutor
This is the base class for all the bridges will implement 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
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 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 callcom.google.cloud.vertexai.api.Type
Map Java type to Gemini type
-
Constructor Details
-
JavaActionExecutor
public JavaActionExecutor()
-
-
Method Details
-
mapType
Map Java type to Gemini type- Parameters:
type
-- Returns:
-
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
-
getGson
protected abstract com.google.gson.Gson getGson()
-