OpenAI-API-dotnet icon indicating copy to clipboard operation
OpenAI-API-dotnet copied to clipboard

ChatMessage Content bugs introduced on 1.9 version

Open jeffdapaz opened this issue 1 year ago • 0 comments

Hi,

Start from version 1.9, the property from ChatMessage class was modified from "string Content" to "IList<ContentItem> ContentItems", but this change was introduced some bugs.

Looking on OpenAI API Reference, it's possible to see that "content" need to be a plain text, not an array:

image

But strangelly the requests are working with OpenAI and Azure. But if you try consume a local LLM based on OpenAI API pattern, overriding the base URL, the requests will not work.

Another problem that I faced it's particullary with Azure.

In some requests I am receiveing something like this as response:

data: {"id":"chatcmpl-8ujtoBAFitfLO0nl5Eenrep","object":"chat.completion.chunk","created":1708533496,"model":"gpt-35-turbo","choices":[{"finish_reason":"stop","index":0,"delta":{"content":null}}]}

Note that the "content" is null. When Azure returns this the exception "Object Not Referenced" was launched by the package at OpenAI_API.Chat.ChatMessage.set_ContentItems(IList`1 value).

Rollback the package to the 1.8 version on my project resolved all these problems, but I am creating this issue to notify you about them.

Thank you.

jeffdapaz avatar Feb 21 '24 17:02 jeffdapaz