Funcchain logo

Funcchain

Free

write prompts, pythonic ![GitHub Repo stars](https://img.shields.io/github/stars/shroominic/funcchain?style=social)

FreeFree tier
Inputs: text, image
Type
Open Source

About Funcchain

Funcchain is a Pythonic framework for building cognitive systems with LLMs. It leverages Pydantic models to define output schemas and LangChain in the backend, compiling the funcchain syntax into LangChain runnables for seamless invocation, streaming, or batch processing. Supports OpenAI Functions and LlamaCpp grammars for efficient structured output, as well as vision models (e.g., GPT-4 Vision) for image analysis. Enables complex nested outputs, union types, and automatic model selection based on input.

Key Features

Leverages Pydantic models as output schemas for structured LLM responses
Compiles funcchain syntax into LangChain runnables for easy invocation, streaming, and batch processing
Supports OpenAI Functions and LlamaCpp grammars (JSON-schema-mode) for efficient structured output
Vision model support (e.g., GPT-4 Vision) for image analysis with structured results
Union type output—model chooses the correct output schema automatically
Seamless integration with Python native features (type hints, functions)

Pros & Cons

Pros
  • Pythonic and intuitive syntax that feels natural to Python developers
  • Automatic parsing of LLM responses into Pydantic models
  • Supports streaming and batching out of the box
  • Works with both cloud (OpenAI) and local (LlamaCpp) LLMs
  • Supports vision models for multi-modal tasks
Cons
  • Requires understanding of Pydantic and LangChain concepts
  • Limited documentation beyond the README and examples
  • Heavy dependency on LangChain, which may be overkill for simple use cases

Best For

Generating structured data (recipes, shopping lists, todo lists) from natural languageBuilding cognitive systems that combine LLMs with Python logicExtracting information from images using vision modelsCreating nested or complex output schemas for data extraction pipelines

FAQ

What is funcchain?
Funcchain is a Pythonic framework that lets you define LLM output schemas using Pydantic models and compiles them into LangChain runnables for easy execution.
How does funcchain handle structured output?
It uses Pydantic models to define the desired output shape and leverages OpenAI Functions or LlamaCpp grammars to enforce that structure in the LLM response.
Can funcchain process images?
Yes, funcchain supports vision models like GPT-4 Vision Preview. You can pass images and define structured analysis results as Pydantic models.