using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VideoAnalysisCore.AICore.GPT.ChatGPT { /// /// 请求数据 /// public class ChatRequest { /// /// 对话 /// public Message[] messages { get; set; } public string model { get; set; } = "gpt-4o"; public float temperature { get; set; } = 0.3f; public float max_tokens { get; set; } = 4000; public object response_format = new { type = "json_object" }; // 指定结构化输出格式 } public class Message { public Message(string content, string role) { this.role = role; this.content = content; } public string role { get; set; } public string content { get; set; } public string refusal { get; set; } } /// /// gpt返回值 /// public class ChatRes { public string id { get; set; } public string _object { get; set; } public int created { get; set; } public string model { get; set; } public ChatResError error { get; set; } public Choice[] choices { get; set; } public Usage usage { get; set; } /// /// 系统指纹 /// public string system_fingerprint { get; set; } } public class Usage { public int prompt_tokens { get; set; } public int completion_tokens { get; set; } public int total_tokens { get; set; } } public class Choice { public int index { get; set; } public Message message { get; set; } public object logprobs { get; set; } public string finish_reason { get; set; } } public class ChatResError { public string message { get; set; } public string type { get; set; } } }