Coding Global Background
Coding Global

object reference not set to an instance of an object

Archived 3 years ago
1 messages
0 members
Created 3 years ago
Updated 3 years ago
Open in Discord
A
ab
        class ChatGPT
        {
            public class Message
            {
                public string role { get; set; } = string.Empty;
                public string content { get; set; } = string.Empty;
            }

            public class Root
            {
                public string model { get; set; } = string.Empty;
                //public int temperature { get; set; }
                //public int max_tokens { get; set; }
                public List<Message> messages { get; set; } 
            }
        }                    

                    ChatGPT.Root chatGPT = new()
                    {
                        model = "gpt-3.5-turbo",
                        messages =
                        {
                            new ChatGPT.Message()
                            {
                                role = "user",
                                content = input
                            }
                        }
                        //temperature = 1,
                        //max_tokens = 100,
                    };

Replies (1)