diff --git a/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionDeclarations.kt b/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionDeclarations.kt index 35c06b7e..262e0759 100644 --- a/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionDeclarations.kt +++ b/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionDeclarations.kt @@ -160,6 +160,16 @@ abstract class FunctionDeclaration(val name: String, val description: String) { abstract suspend fun execute(part: FunctionCallPart): JSONObject } +/** + * Represents a parameter for a declared function + * + * @property name: The name of the parameter + * @property description: The description of what the parameter should contain or represent + * @property format: format information for the parameter, this can include bitlength in the case of + * int/float or keywords like "enum" for the string type + * @property enum: contains the enum values for a string enum + * @property type: contains the type info and parser + */ class ParameterDeclaration( val name: String, val description: String, diff --git a/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionParameter.kt b/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionParameter.kt index cb9ccbe1..8d2f21e9 100644 --- a/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionParameter.kt +++ b/generativeai/src/main/java/com/google/ai/client/generativeai/type/FunctionParameter.kt @@ -16,4 +16,5 @@ package com.google.ai.client.generativeai.type + class FunctionParameter(val name: String, val description: String, val type: FunctionType) {} diff --git a/generativeai/src/main/java/com/google/ai/client/generativeai/type/Type.kt b/generativeai/src/main/java/com/google/ai/client/generativeai/type/Type.kt index c1fea3cf..c220031d 100644 --- a/generativeai/src/main/java/com/google/ai/client/generativeai/type/Type.kt +++ b/generativeai/src/main/java/com/google/ai/client/generativeai/type/Type.kt @@ -20,6 +20,13 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.jsonArray import org.json.JSONObject +/** + * Represents and passes the type information for an automated function call. + * + * @property name: the enum name of the type + * @property parse: the deserialization function + * @property T: the type of the object that this maps to in code. + */ class FunctionType(val name: String, val parse: (String?) -> T?) { companion object { val STRING = FunctionType("STRING") { it }