

MonkeyPatch
MonkeyPatch is a way to easily call an LLM in place of the function body in Python, with the same parameters and output that you would expect from a function implemented by hand.
Cost / License
- Free
- Open Source
Application type
Platforms
- Mac
- Windows
- Linux
- BSD
- Python

MonkeyPatch
Features
- AI-Powered
Tags
- Artificial intelligence
- ChatGPT
- Python
- gpt4
- python-lib
MonkeyPatch News & Activities
Recent activities
MonkeyPatch information
What is MonkeyPatch?
MonkeyPatch is a way to easily call an LLM in place of the function body in Python, with the same parameters and output that you would expect from a function implemented by hand.
These LLM-powered functions are well-typed, reliable, stateless, and production-ready to be dropped into your app seamlessly. Rather than endless prompt-wrangling and nasty surprises, these LLM-powered functions and applications behave like traditional functions with proper error handling.
Lastly, the more you use MonkeyPatch functions, the cheaper and faster they gets (up to 9-10x!) through automatic model distillation.
Features
- Easy and seamless integration - Add LLM augmented functions to any workflow within seconds. Decorate a function stub with @monkey.patch and optionally add type hints and docstrings to guide the execution. That’s it.
- Type aware - Ensure that the outputs of the LLM adhere to the type constraints of the function (Python Base types, Pydantic classes, Literals, Generics etc) to guard against bugs or unexpected side-effects of using LLMs.
- Aligned outputs - LLMs are unreliable, which makes them difficult to use in place of classically programmed functions. Using simple assert statements in a function decorated with @monkey.align, you can align the behaviour of your patched function to what you expect.
- Lower cost and latency - Achieve up to 90% lower cost and 80% lower latency with increased usage. The package will take care of model training, MLOps and DataOps efforts to improve LLM capabilities through distillation.
- Batteries included - No remote dependencies other than OpenAI.