A Kotlin multiplatform JSON Schema library. Useful for AI and LLMs' tool use (function calling), as it generates JSON Schema for Kotlin @Serializable

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-12-02 18:00:03

A Kotlin multiplatform JSON Schema library. Useful for AI and LLMs' tool use (function calling), as it generates JSON Schema for Kotlin @Serializable classes.

These projects are heavily dependent on tool use (function calling) functionality provided by many Large Language Models. Thanks to xemantic-ai-tool-schema, a Kotlin class, with possible additional constraints, can be automatically instantiated from the JSON tool use input provided by the LLM. This way any manual steps of defining JSON schema for the model are avoided, which reduce a chance for errors in the process, and allows to rapidly develop even complex data structures passed to an AI agent.

In short the xemantic-ai-tool-schema library can generate a JSON Schema from any Kotlin class marked as @Serializable, according to kotlinx.serialization.

You might be familiar with similar functionality of the Pydantic Python library, however, the standard Kotlin serialization is already fulfilling model metadata provisioning, so this analogy might be misleading.

Leave a Comment