Tool for local LLM function calling with JSON schema enforcement
Top 70.4% on sourcepulse
This project provides a tool for local Large Language Models (LLMs) to generate function arguments and select functions to call, mimicking OpenAI's function calling feature but with strict JSON schema enforcement. It's designed for developers and researchers working with Hugging Face text generation models who need to reliably extract structured data or trigger specific actions based on LLM output.
How It Works
The library leverages a Generator
class that integrates with Hugging Face models. It constructs prompts that guide the LLM to produce output conforming to a specified JSON schema, which is then enforced by an underlying json-schema-enforcer
component. This approach ensures that the LLM's output is not only relevant but also strictly adheres to the defined structure, enabling reliable data extraction and function invocation.
Quick Start & Requirements
pip install local-llm-function-calling
transformers
library, Python 3.7+.Generator
with functions and a prompt.Highlighted Details
transformers
models.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The project is described as "quickly sketched" and relies on a separate, similarly described json-schema-enforcer
project, suggesting potential for early-stage instability or missing features. The lack of explicit licensing information may pose compatibility concerns for commercial or closed-source use.
1 year ago
1 week