Skip to content

v0.37.0

Latest
Compare
Choose a tag to compare
@jackmpcollins jackmpcollins released this 15 Jan 07:00

What's Changed

The @prompt_chain decorator can now accept a sequence of Message as input, like @chatprompt.

from magentic import prompt_chain, UserMessage

def get_current_weather(location, unit="fahrenheit"):
    """Get the current weather in a given location"""
    return {"temperature": "72", "forecast": ["sunny", "windy"]}

@prompt_chain(
    template=[UserMessage("What's the weather like in {city}?")],
    functions=[get_current_weather],
)
def describe_weather(city: str) -> str: ...

describe_weather("Boston")
'The weather in Boston is currently 72°F with sunny and windy conditions.'

PRs

Full Changelog: v0.36.0...v0.37.0