Skip to content
This repository was archived by the owner on Jun 12, 2025. It is now read-only.

v0.5.0

Choose a tag to compare

@piercefreeman piercefreeman released this 14 Apr 04:10
· 5 commits to main since this release

What's Changed

GPT Vision

This release adds support for GPT Vision models by switching to the new content array syntax for prompting the GPT API. This allows messages to have an arbitrary amount of content specified, versus just the single string that was true in older API versions. If you provide a raw string to the GPTMessage constructor, we will handle this conversion internally. This makes the changes reverse compatible with older gpt-json versions.

You can use with the same syntax as sending a standard text message:

response = await gpt_json.run(
        messages=[
            GPTMessage(role=GPTMessageRole.SYSTEM, content=SYSTEM_PROMPT.strip()),
            GPTMessage(
                role=GPTMessageRole.USER,
                content=[
                    TextContent(text="Message text"),
                    ImageContent.from_url(my_image_url)
                ],
            ),
        ],
        format_variables=dict(post_content=post_text),
        max_response_tokens=500,
    )

New Included Models

We upgrade our supported GPTModelVersion to mirror the currently available list of models within the API.

class GPTModelVersion(Enum):
    GPT_3_5_0613
    GPT_3_5_1106
    GPT_3_5_0125

    GPT_4_0613
    GPT_4_32K_0613
    GPT_4_VISION_PREVIEW_1106