Yesterday we launched a new open-source product called Marvin. Marvin is a library for building AI-powered software and it’s taking off faster than we could have imagined. We think you’ll find it helpful in your workflows.
Marvin’s headline feature is AI Functions. These are minimal functions with typed inputs and outputs and a docstring, but no source code.
Yes. You read that right. There’s no source code required.
Instead, when you call an AI Function, the output is predicted by GPT-4 (or GPT-3.5). We know this sounds but it works astoundingly well.
You just write the def
of a function you wish you had… and then you call it.
To get this magic, just add Marvin’s @ai_fn
decorator. Here’s an example:
from marvin import ai_fn
@ai_fn
def spam_rating(email_body: str) -> int:
""" Returns a number between 0 and 100 that represents how likely the email is spam """
spam_rating("Hey, just following up about dinner tomorrow.") # 17
spam_rating("Hi, I'm Nigerian prince and I really need your help.") # 95
️Obviously, this is cool. But more importantly, it aligns with Prefect’s product mission to eliminate negative engineering and bring engineers as close as possible to their objectives.
Give Marvin a star on GitHub, join the community in Discord, and stay tuned — AI functions are just the beginning of what it can do.
Happy engineering!
The Prefect Team