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
Could someone provide a code example of how to take an existing class, convert it to a string so that it can be read by completechat function? I have tried using the following but I get an error:
string cm = "This is a test";
Newtonsoft.Json.Schema.Generation.JSchemaGenerator generator = new Newtonsoft.Json.Schema.Generation.JSchemaGenerator();
Newtonsoft.Json.Schema.JSchema schema = generator.Generate(typeof(MyClass));
ChatResponseFormat format = ChatResponseFormat.CreateJsonSchemaFormat(
"Report_Outline",
BinaryData.FromString(schema.ToString()), null,
true);
ChatCompletionOptions options = new ChatCompletionOptions()
{
ResponseFormat = format
};
ChatCompletion chatCompletion = client.CompleteChat([new UserChatMessage(cm),], options);
Here is the error I get:
Invalid schema for response_format 'Report_Outline': schema must be a JSON Schema of 'type: "object"', got 'type: "None"'.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Could someone provide a code example of how to take an existing class, convert it to a string so that it can be read by completechat function? I have tried using the following but I get an error:
string cm = "This is a test";
Here is the error I get:
Invalid schema for response_format 'Report_Outline': schema must be a JSON Schema of 'type: "object"', got 'type: "None"'.
Beta Was this translation helpful? Give feedback.
All reactions