Today we’re excited to release Marvin 1.5. We’re:
Putting the `engineering` in prompt engineering with our new prompt_fn, and
Speeding up serialization in Marvin by ~50x by transitioning to Pydantic V2.
Last week we released 1.4, and the response has been overwhelmingly positive. At its core, Marvin translates your Python code to English (“serialization”) and then calls a Large Language Model on your behalf (“execution”) before parsing its result. We shipped the first step of what we called the separation of ‘serialization’ and ‘execution’. This week we’re doubling down.
Prompt Functions
This week we introduce prompt functions, or prompt_fn. We now expose a low-level decorator that lets you write prompts as functions. This lets you build fully type-hinted prompts that other engineers can introspect, version, and test. Let’s take a look (long photo ahead):
Every parameter above is fully-customizable. There’s no black-box, or “magic” separating you from the prompt you want to write and the powerful serialization engine that powers Marvin. To see more examples check out our docs.
Pydantic V2 Migration
Pydantic is one of the most popular Python libraries today for validating and serializing data models. Not only is it useful as a developer, but it exposes really helpful components for turning a Python data model into an industry-standard schema that GPT and other Large Language Models are accustomed to parsing. This standardized schema and its cameo its played in GPT’s training data gives us an effective way to communicate rigorous types back and forth in English and code.
Pydantic recently rebuilt its entire foundation in Rust and, as a result, boasts a 50x speed improvement. It’s a treat to work with, and it’s the version of choice for developers starting new projects. We’re excited to support developers working with either Pydantic V1 or V2!
The feedback from Marvin users has been loud and clear: it’s the most ergonomic framework for working with Large Language Models. It’s a framework that feels familiar: if you know Python, you know Marvin.
Upgrade today (pip install marvin -U)
, check out the docs, and give the repo a star!