#Extra Fields not Permitted Error (with no extra fields??)

7 messages · Page 1 of 1 (latest)

turbid grove
#

    response = requests.post(
        url="https://openrouter.ai/api/v1/chat/completions",
        headers={
            "Authorization": f"Bearer {os.environ['OPENROUTER_API_KEY']}",
        },
        data=json.dumps(
            {
                "models": [
                    "openai/gpt-4-vision-preview",
                    "google/gemini-pro-vision",
                    "nousresearch/nous-hermes-2-vision-7b",
                ],
                "route": "fallback",
                "messages": [
                    {
                        "role": "user",
                        "content": [
                            {
                                "type": "text",
                                "text": "If the image is a bar chart, respond ONLY with the word chart. Otherwise, concisely describe this image (max 3 sentences).",
                            },
                            {
                                "type": "image_url",
                                "image_url": {
                                    "url": f"data:image/jpeg;base64,{base64.b64encode(image_bytes.read()).decode('utf-8')}"
                                },
                            },
                        ],
                    }
                ],
            }
        ),
    )

Running the above.

And getting this response:

{'error': {'message': '{\n  "error": {\n    "message": "2 validation errors for Request\\nbody -> logit_bias\\n  extra fields not permitted (type=value_error.extra)\\nbody -> response_format\\n  extra fields not permitted (type=value_error.extra)",\n    "type": "invalid_request_error",\n    "param": null,\n    "code": null\n  }\n}', 'code': 400}} 
grave blaze
#

Looking

#

We recently changed parameter validation

#

cc @autumn parrot

grave blaze
#

Found the issue - deploying a fix. thanks for flagging @turbid grove ! if you dm me your openrouter email, we'll give you some credits for the hassle

turbid grove
grave blaze
#

sent!