[Python] mistralai - AttributeError: 'ChatMessage' object has no attribute 'model_dump'

Discussão em 'Python' iniciado por Stack, Dezembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to run a Mistral AI's python client code example shown below.

    from mistralai.client import MistralClient
    from mistralai.models.chat_completion import ChatMessage

    model = "mistral-tiny"

    client = MistralClient(api_key=userdata.get('MISTRAL_API_KEY'))

    messages = [
    ChatMessage(role="user", content="What is the best French cheese?")
    ]

    # No streaming
    chat_response = client.chat(
    model=model,
    messages=messages,
    )


    I keep getting AttributeError: 'ChatMessage' object has no attribute 'model_dump' but there is nothing about this anywhere.

    Can someone help please?

    Continue reading...

Compartilhe esta Página