Skip to content

v0.36.0

Compare
Choose a tag to compare
@jackmpcollins jackmpcollins released this 12 Jan 06:35
· 2 commits to main since this release

What's Changed

Document the Chat class and make it importable from the top level.
docs: https://magentic.dev/chat/

from magentic import Chat, OpenaiChatModel, UserMessage

# Create a new Chat instance
chat = Chat(
    messages=[UserMessage("Say hello")],
    model=OpenaiChatModel("gpt-4o"),
)

# Append a new user message
chat = chat.add_user_message("Actually, say goodbye!")
print(chat.messages)
# [UserMessage('Say hello'), UserMessage('Actually, say goodbye!')]

# Submit the chat to the LLM to get a response
chat = chat.submit()
print(chat.last_message.content)
# 'Hello! Just kidding—goodbye!'

PRs

Full Changelog: v0.35.0...v0.36.0