
Marvin AI Has a Free API: The AI Engineering Toolkit That Makes LLMs Predictable
LLMs are unpredictable. Marvin makes them predictable — with typed functions, classifiers, and extractors that return structured data. What Is Marvin? Marvin is a Python toolkit for building AI-powered features. Instead of wrestling with prompts, you use high-level abstractions that return typed Python objects. import marvin # Classify text into categories result = marvin . classify ( " I can ' t believe they charged me twice! " , labels = [ " billing " , " technical " , " account " , " shipping " ] ) print ( result ) # "billing" # Extract structured data from pydantic import BaseModel class Location ( BaseModel ): city : str state : str country : str locations = marvin . extract ( " I flew from San Francisco to New York, then London " , target = Location ) # [Location(city="San Francisco", state="CA", country="US"), # Location(city="New York", state="NY", country="US"), # Location(city="London", state="", country="UK")] AI Functions @marvin.fn def sentiment ( text : str ) -> float : '
Continue reading on Dev.to Python
Opens in a new tab


