v0.20.0
Warning
The default model for magentic is now gpt-4-turbo
instead of gpt-3.5-turbo
. See Configuration for how to change this.
What's Changed
- Tidy up docs by @jackmpcollins in #181
- Set default LLM to gpt-4-turbo. Update vision docs. by @jackmpcollins in #183
- Bump anthropic from 0.23.1 to 0.25.1 by @dependabot in #180
- Bump peaceiris/actions-gh-pages from 3 to 4 by @dependabot in #178
- Bump aiohttp from 3.9.3 to 3.9.4 by @dependabot in #182
- Bump idna from 3.6 to 3.7 by @dependabot in #176
- Bump openai from 1.14.2 to 1.17.1 by @dependabot in #177
- Bump litellm from 1.34.0 to 1.35.5 by @dependabot in #179
- Included fix for Anthropic responses that contain both content and tool_calls
Full Changelog: v0.19.0...v0.20.0
Having a default of gpt-4-turbo
enables using vision with function calling by default
from pydantic import BaseModel, Field
from magentic import chatprompt, UserMessage
from magentic.vision import UserImageMessage
IMAGE_URL_WOODEN_BOARDWALK = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
class ImageDetails(BaseModel):
description: str = Field(description="A brief description of the image.")
name: str = Field(description="A short name.")
@chatprompt(
UserMessage("Describe the following image in one sentence."),
UserImageMessage(IMAGE_URL_WOODEN_BOARDWALK),
)
def describe_image() -> ImageDetails: ...
image_details = describe_image()
print(image_details.name)
# 'Wooden Boardwalk in Green Wetland'
print(image_details.description)
# 'A serene wooden boardwalk meanders through a lush green wetland under a blue sky dotted with clouds.'