[Python] Cannot submit chat request to VLLM Pixtral in Python using MistralAI

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Pixtral server running locally.

    I have installed mistralai 1.2.3 on MacOS and am trying to interact with the server.

    When I run

    curl -X POST http://localhost:8000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{"model": "mistralai/Pixtral-12B-2409", "messages": [{"role": "user", "content": "What is the best French cheese?"}]}'


    I get back the expected response, but when I run it from Python

    from mistralai import Mistral

    model = "mistralai/Pixtral-12B-2409"
    client = Mistral(server_url="http://localhost:8000")

    chat_response = client.chat.complete(
    messages=[
    {
    "role": "user",
    "content": "What is the best French cheese?"
    }
    ],
    model=model,
    )

    print(chat_response.choices[0].message.content)



    I get this error:

    raise models.SDKError(
    mistralai.models.sdkerror.SDKError: API error occurred: Status 400
    {"object":"error","message":"[{'type': 'extra_forbidden', 'loc': ('body', 'safe_prompt'), 'msg': 'Extra inputs are not permitted', 'input': False}]","type":"BadRequestError","param":null,"code":400}


    How can I solve this problem?

    Continue reading...

Compartilhe esta Página