local-llm-function-calling  by rizerphe

Tool for local LLM function calling with JSON schema enforcement

Created 2 years ago
429 stars

Top 69.1% 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

Inactive

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

Explore Similar Projects

Starred by Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), Tri Dao Tri Dao(Chief Scientist at Together AI), and
1 more.

hnet by goombalab

1.5%
722
Hierarchical sequence modeling with dynamic chunking
Created 2 months ago
Updated 1 month ago
Starred by Kaichao You Kaichao You(Core Maintainer of vLLM), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
3 more.

lm-format-enforcer by noamgat

0.6%
2k
Format enforcer for language model outputs (JSON, regex, etc.)
Created 2 years ago
Updated 3 weeks ago
Starred by Jared Palmer Jared Palmer(Ex-VP AI at Vercel; Founder of Turborepo; Author of Formik, TSDX), Vincent Weisser Vincent Weisser(Cofounder of Prime Intellect), and
8 more.

llm-vscode by huggingface

0.1%
1k
VSCode extension for LLM-powered code development
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.