local-llm-function-calling  by rizerphe

Tool for local LLM function calling with JSON schema enforcement

created 2 years ago
427 stars

Top 70.4% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

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

  • Primary install: pip install local-llm-function-calling
  • Prerequisites: Hugging Face transformers library, Python 3.7+.
  • Example usage: See the provided Python snippet for initializing the Generator with functions and a prompt.

Highlighted Details

  • Enforces JSON schema compliance for LLM output, unlike OpenAI's implementation.
  • Supports custom constraints and prompt formulation beyond the built-in methods.
  • Integrates with Hugging Face transformers models.

Maintenance & Community

  • Developed by rizerphe.
  • No explicit community links (Discord, Slack) or roadmap are provided in the README.

Licensing & Compatibility

  • The README does not specify a license.

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.

Health Check
Last commit

1 year ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
4 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Andreas Jansson Andreas Jansson(Cofounder of Replicate), and
1 more.

lm-format-enforcer by noamgat

0.2%
2k
Format enforcer for language model outputs (JSON, regex, etc.)
created 1 year ago
updated 5 months ago
Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake), and
21 more.

guidance by guidance-ai

0.1%
21k
Guidance is a programming paradigm for steering LLMs
created 2 years ago
updated 1 day ago
Feedback? Help us improve.