Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pse

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pse

Proxy Structuring Engine: Ensures AI-generated output adheres to predefined schemas without compromising creativity, speed, or context.

  • 1.1.0
  • Source
  • PyPI
  • Socket score

Maintainers
1

Proxy Structuring Engine (PSE)

Bringing Order to Chaos: Efficient Schema-Guided Sampling for LLMs

Build Status License

OverviewInstallationFeaturesBenchmarks

Overview

The Proxy Structuring Engine (PSE) works in tandem with Large Language Models (LLMs) to ensure generated outputs adhere to predefined schemas without compromising creativity, speed, or context. This enables error-free custom tool calling, complex multi-step reasoning, and unlocks new creative possibilities for AI applications.

PSE achieves this through a novel schema-guided sampling approach, leveraging Directed Acyclic Word Graphs (DAWGs) and finite state machines to enforce constraints during text generation.

Installation

PSE supports multiple backends such as PyTorch, JAX, and MLX for maximum flexibility and performance.

To install the base package:

pip install pse

To install with optional backend support, use one of the following:

pip install pse[torch]  # PyTorch support
pip install pse[jax]    # JAX support
pip install pse[mlx]    # MLX support
pip install pse[all]    # All optional features

Features

  • 🚀 Multi-Backend Support: Compatible with PyTorch, JAX, and MLX backends.
  • 🛠 Schema-Guided Sampling: Enforces JSON schema constraints during text generation.
  • High Performance: Minimal overhead ensures fast generation speeds.
  • 🎨 Maintains Creativity: Preserves model creativity while enforcing structure.
  • 🤖 Easy Integration: Seamlessly integrates with Hugging Face Transformers.
  • 📚 Expanded Schema Support: Supports JSON Schema with plans to expand to other formats (SQL, Cypher, Python, U-DIFF).
  • Comprehensive Testing: Ensures code reliability with 90% test coverage.
  • 🔍 Detailed Documentation: Improves readability and developer experience.
  • 🧩 Customizable Hooks: start_hook and end_hook enable custom logic injection.
  • 🔄 Robust Error Handling: Facilitates debugging and integration.

Benchmarks

The Proxy Structuring Engine consistently outperforms traditional sampling methods in both speed and accuracy:

(Benchmarks will be added soon.)

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Acknowledgements

PSE builds upon the groundwork laid by LLM Structured Output and utilizes lexpy for efficient lexicon analysis.


Made with care ❤️ by The Proxy Company

TwitterWebsiteContact

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc