LLFn logo

LLFn

Free

A light-weight framework for creating applications using LLMs ![GitHub Repo stars](https://img.shields.io/github/stars/orgexyz/LLFn?style=social)

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About LLFn

LLFn (read: Elephant) is a lightweight, open-source Python framework designed to simplify the creation of applications using large language models (LLMs). Inspired by FastAPI and LangChain, it introduces a single core primitive: the function. Developers can turn any prompt into a callable function, define structured outputs with Python and Pydantic types, and compose functions infinitely. LLFn supports any LangChain-compatible LLM, making it easy to experiment with and ship AI applications with minimal boilerplate. The framework is small, easy to understand, and extend, allowing even newcomers to be productive in minutes.

Key Features

Functionify: Turn any prompt into a callable function
Flexible Output: Define LLM results using Python and Pydantic types
Infinitely Composable: Any function can call any other function in any order
Use Any LLM: Leverage LangChain's LLM interface for 100% compatibility
Lightweight: Small core making it easy to understand and extend

Pros & Cons

Pros
  • Minimal boilerplate; functions are the only abstraction needed
  • Uses familiar Python function syntax with type hints
  • Seamlessly integrates with any LangChain-supported LLM
  • Lightweight and easy to extend
  • Free and open-source under MIT license
Cons
  • Documentation is limited to the README and examples
  • Relatively new project with fewer community resources
  • Requires LangChain as a dependency for LLM binding

Best For

Text summarizationBuilding AI agentsLanguage translation (e.g., English to Thai)Rapid prototyping of LLM-powered applicationsComposable multi-step LLM workflows

FAQ

How do I install LLFn?
LLFn can be installed via pip from the GitHub repository or PyPI (if published). The repository includes a pyproject.toml, so installation is done with `pip install llfn` or by cloning the repo and running `pip install .`.
What LLMs does LLFn support?
LLFn works with any language model supported by LangChain, including OpenAI's GPT models, Anthropic's Claude, and others, by binding the LangChain chat model to the function.
How do I define a function in LLFn?
You create a function with type-hinted inputs and return type annotation, decorate it with @function_prompt, and return a prompt string. The function is then callable like a normal Python function after binding an LLM.
Is LLFn free to use?
Yes, LLFn is open-source and free to use. You may need to pay for the underlying LLM API calls (e.g., OpenAI API) depending on your usage.