jeffdapaz / VisualChatGPTStudio

Add chatGPT functionalities directly on Visual Studio
https://marketplace.visualstudio.com/items?itemName=jefferson-pires.VisualChatGPTStudio
MIT License
210 stars 51 forks source link

Invalid Request Error: str type expected #66

Closed leejunweisg closed 7 months ago

leejunweisg commented 7 months ago

Hi, I am trying to use the extension with my local OpenAPI-compatible LLM, but I am facing an "str type expected error".

This is the error response:

{
    "object": "error",
    "message": "[{'loc': ('body', 'messages'), 'msg': 'str type expected', 'type': 'type_error.str'}, {'loc': ('body', 'messages', 0, 'content'), 'msg': 'str type expected', 'type': 'type_error.str'}]",
    "type": "invalid_request_error",
    "param" null,
    "code": null
}

Upon inspecting the requests, I noticed that the plugin is sending the request in this structure:

{
    "messages": [
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": "You are a programmer assistant called ..."
                }
            ]
        }
    ],
    ...
}

However, the OpenAI API reference shows this structure instead:

{
    "messages": [
        {
            "role": "system",
            "content": "You are a programmer assistant called ..."
        }
    ],
    ...
}

May I know what could be the issue? Thanks! 🙏

jeffdapaz commented 7 months ago

Hi @leejunweisg ,

I will investigate and tell you something when a have some details.

jeffdapaz commented 7 months ago

Hi @leejunweisg,

I made tests and found the problem. The lasts plugin's versions came with this bug and another ones that I found now related if the "content" object.

I rollbacked the plugin version and now all are working fine. I published a new release with this fix.