Skip to content

v0.29.0

Compare
Choose a tag to compare
@jackmpcollins jackmpcollins released this 08 Aug 06:29
· 39 commits to main since this release

What's Changed

This means Message objects can be used anywhere pydantic models can, including in prompt-functions. The new AnyMessage type simplifies this. For example

from magentic import AnyMessage, prompt

@prompt("Create an example of few-shot prompting for a chatbot")
def make_few_shot_prompt() -> list[AnyMessage]: ...

make_few_shot_prompt()
# [SystemMessage('You are a helpful and knowledgeable assistant.'),
#  UserMessage('What’s the weather like today?'),
#  AssistantMessage[Any]('The weather today is sunny with a high of 75°F (24°C).'),
#  UserMessage('Can you explain the theory of relativity in simple terms?'),
#  AssistantMessage[Any]('Sure! The theory of relativity, developed by Albert Einstein,  ...]

Dependabot

Full Changelog: v0.28.1...v0.29.0