Skip to content

Releases: jackmpcollins/magentic

v0.39.2

02 Mar 06:00
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.39.1...v0.39.2

v0.39.1

02 Mar 05:35
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.39.0...v0.39.1

v0.39.0

24 Feb 10:13
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.38.1...v0.39.0

v0.38.1

29 Jan 08:06
Compare
Choose a tag to compare

What's Changed

  • fix - function call with no args when using anthropic api by @ananis25 in #408

Full Changelog: v0.38.0...v0.38.1

v0.38.0

27 Jan 08:10
Compare
Choose a tag to compare

What's Changed

  • Async streamed response to api message conversion by @ananis25 in #405
  • Support AsyncParallelFunctionCall in message_to_X_message by @jackmpcollins in #406

Full Changelog: v0.37.1...v0.38.0

v0.37.1

24 Jan 05:51
Compare
Choose a tag to compare

What's Changed

Anthropic model message serialization now supports StreamedResponse in AssistantMessage. Thanks to @ananis25 🎉

PRs

  • add msg-to-anthropic-msg converter for streamedresponse by @ananis25 in #404

New Contributors

Full Changelog: v0.37.0...v0.37.1

v0.37.0

15 Jan 07:00
Compare
Choose a tag to compare

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

v0.36.0

12 Jan 06:35
Compare
Choose a tag to compare

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

v0.35.0

06 Jan 03:33
Compare
Choose a tag to compare

What's Changed

UserMessage now accepts image urls, image bytes, and document bytes directly using the ImageUrl, ImageBytes, and DocumentBytes types.

Example of new UserMessage syntax and DocumentBytes

from pathlib import Path

from magentic import chatprompt, DocumentBytes, Placeholder, UserMessage
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel


@chatprompt(
    UserMessage(
        [
            "Repeat the contents of this document.",
            Placeholder(DocumentBytes, "document_bytes"),
        ]
    ),
    model=AnthropicChatModel("claude-3-5-sonnet-20241022"),
)
def read_document(document_bytes: bytes) -> str: ...


document_bytes = Path("...").read_bytes()
read_document(document_bytes)
# 'This is a test PDF.'

PRs

New Contributors

Full Changelog: v0.34.1...v0.35.0

v0.34.1

01 Dec 08:10
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.34.0...v0.34.1