Skip to content

v0.5.0

Compare
Choose a tag to compare
@jackmpcollins jackmpcollins released this 15 Sep 08:59
· 212 commits to main since this release

What's Changed

Full Changelog: v0.4.1...v0.5.0


from magentic import prompt_chain


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


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


output = await describe_weather("Boston")