Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add TextChunk as possible content type for Assistant message #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gcalmettes
Copy link

@gcalmettes gcalmettes commented Sep 23, 2024

Currently, the AssistantMessage class only accepts str as type. It is the only role only accepting nothing else than str (or None) as content.

This means that payload generated when using the Mistral tokenizer via external systems (e.g. vllm) also accepting TextChunk as content for the Assistant message, will break:

"messages": [
    {
        "role": "system",
        "content": [
            {
                "type": "text", "text": "\nCurrent model: pixtral-12b-2409\nCurrent date: 2024-09-23T07:14:36.737Z\n\nYou are a helpful assistant. You can help me by answering my questions. You can also ask me questions."
                }
        ]
    },
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "Does the animal in the first image could live in what is describe in the second image ?"
            },
            {
                "type": "image_url",
                "image_url": {
                "url": "https://some-urls"
                }
            },
            {
                "type": "image_url",
                "image_url": {
                    "url": "https://some-urls"
                }
            }
        ]
    },
    {
        "role": "assistant",
        "content": [
            {
                "type": "text",
                "text": "Some response from Pixtral."
            }
        ]
    },
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "What time is it ?"
            }
        ]
    }
]

This MR adds TextChunk as possible content type for the AssistantMessage class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant