Constrained Generation
Please refer to Constrained Generation guide on detailed usage.JSONSchemaGenerator
JSONSchemaGenerator only exposes one public method:
getJSONSchema:
klass: the Kotlin class object created fromT::class. It must be a data class annotated withGeneratable.indentSpaces: a non null value will format the JSON output into a pretty style with the given indent spaces.
LeapGeneratableSchematizationException will be thrown.
GeneratableFactory
GeneratableFactory exposes createFromJSONObject methods:
jsonObject: the JSON object as the data source for creating the generatable data class instance.klass: the Koltin class object created fromT::class. It must be a data class annotated withGeneratable.
Annotations
Generatable annotation is for the data class to be used as the generation constraints. Guide is for the fields of the generatable data class to add helpful
descriptions for the fields.
Function Calling
Please refer to Function calling guide on detailed usage.LeapFunction
LeapFunction describes the signature of a function that can be called by the model.
nameName of the function.descriptionA human and LLM readable description for the function.parameteresThe list of parameters that is accepted by the function.
LeapFunctionParameter
LeapFunctionParameter describes the signature of a parameter in a function.
nameName of the paramter.typeData type of the parameter.descriptionA human and LLM readable description for the parameter.optional: Whether this parameter is optional.
LeapFunctionParameterType
LeapFunctionParameterType Represents a data type that can be used for the parameters of Leap functions. All types declared must
be allowed in JSON Schema.
Stringrepresents a string literal. ItsenumValuesfield can be used to restrict the range of the accepted values.Numberrepresents a number literal. It could be an integer or a floating point number. ItsenumValuesfield can be used to restrict the range of the accepted values.Integerrepresents an integer literal. ItsenumValuesfield can be used to restrict the range of the accepted values.Booleanrepresents a boolean literal.Nulltype only accepts null value.Arrayrepresents an array literal. ItsitemTypefield describes the data type of its items.Objectrepresent an object literal. Itspropertiesfield is a map of the property names to their data types.requiredfield lists all properties that are required to present.
LeapFunctionCall
LeapFunctionCall describes a function call request generated by the model.
nameName of the function to be calledargumentsThe arguments (parameters) of this call in a map. Values could be strings, numbers, booleans, null, lists for arrays, or maps for objects.
LeapFunctionCallParser
LeapFunctionCallParser is capable to parse the function call requests from the models into LeapFunctionCall instances. There are two implementations:
LFMFunctionCallParserThe function call parser for Liquid Foundation Models (LFM2). This is the default parser.HermesFunctionCallParserThe function call parser for Hermes function calling format.