PrefectHQ / marvin

✨ Build AI interfaces that spark joy
https://askmarvin.ai
Apache License 2.0
5.34k stars 348 forks source link

Allow passing instructions to @model #856

Closed jlowin closed 8 months ago

jlowin commented 9 months ago

You can pass instructions to steer model transformation via the instructions parameter:

@marvin.model(instructions='Always generate locations in California')
class Location(BaseModel):
    city: str
    state: str

Location('a large city')   
# Location(city='Los Angeles', state='California')

Note that instructions are set at the class level, so they will apply to all instances of the model. To customize instructions on a per-instance basis, use cast with the instructions parameter instead.