You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, recently saw your library, it fits my needs perfectly. I am using the original Nuget package, I am now loading and saving data with the following code:
publicstatic Conversation LoadChatMessagesFromFile(Conversationchat,stringpath){stringinputJson= File.ReadAllText(path);varmessages= JsonConvert.DeserializeObject<IList<ChatMessage>>(inputJson);
chat.Messages.Clear();foreach(var chatMessage in messages){
chat.Messages.Add(chatMessage);}returnchat;}
[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Hi, whats up?",
"image_url": null
}
],
"name": null
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I'm just here to help with any questions or tasks you may have. How can I assist you today?",
"image_url": null
}
],
"name": null
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Talk about yourself",
"image_url": null
}
],
"name": null
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "I am a language model AI designed to assist with a wide range of tasks and provide information on various topics. I am constantly learning and improving to better serve users like you. Is there anything specific you would like to know or discuss?",
"image_url": null
}
],
"name": null
}
]
But an exception is thrown when loading in runtime:
line:
exception: Newtonsoft.Json.JsonSerializationException: "Error setting value to 'ContentItems' on 'OpenAI_API.Chat.ChatMessage'."
innerException: NullReferenceException: Object reference not set to an instance of an object.
Any advice on how this can be fixed?
The text was updated successfully, but these errors were encountered:
Just wanted to say that I am also experiencing this. I didn't have problems serializing using an old version of the library. Just started happening when I upgraded today.
Hi, recently saw your library, it fits my needs perfectly. I am using the original Nuget package, I am now loading and saving data with the following code:
Serialization is done using Newtonsoft.Json:
But an exception is thrown when loading in runtime:
line:
exception: Newtonsoft.Json.JsonSerializationException: "Error setting value to 'ContentItems' on 'OpenAI_API.Chat.ChatMessage'."
innerException: NullReferenceException: Object reference not set to an instance of an object.
Any advice on how this can be fixed?
The text was updated successfully, but these errors were encountered: