All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.frtu.kotlin.tool.function.Function.kt Maven / Gradle / Ivy

There is a newer version: 2.0.9
Show newest version
package com.github.frtu.kotlin.tool.function

import com.github.frtu.kotlin.action.management.ActionId
import com.github.frtu.kotlin.tool.ToolExecuter
import com.github.frtu.kotlin.serdes.json.schema.SchemaGen

/**
 * Base class for callable function
 */
abstract class Function(
    id: ActionId,
    description: String,
    parameterJsonSchema: String,
    returnJsonSchema: String?,
//    val parameters: List,
) : ToolExecuter(
    id = id,
    description = description,
    parameterJsonSchema = parameterJsonSchema,
    returnJsonSchema = returnJsonSchema,
) {
    constructor(
        id: String,
        description: String,
        parameterClass: Class,
        returnClass: Class?,
    ) : this(
        id = ActionId(id),
        description = description,
        parameterJsonSchema = SchemaGen.generateJsonSchema(parameterClass),
        returnJsonSchema = returnClass?.let { SchemaGen.generateJsonSchema(returnClass) },
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy