namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
{
public class MessagesItem
{
public MessagesItem()
{
}
public MessagesItem(string content, string role = "user")
{
this.content = content;
this.role = role;
}
///
///
///
public string role { get; set; }
///
///
///
public string content { get; set; }
}
///
/// chat请求参数
///
public class ChatReq
{
///
/// 使用的模型
/// 例如[ moonshot-v1-8k ]
///
public string model { get; set; } = "moonshot-v1-8k";
///
/// 消息主体
///
public List messages { get; set; }
///
/// 使用什么采样温度,介于 0 和 1 之间。较高的值(如 0.7)将使输出更加随机,而较低的值(如 0.2)将使其更加集中和确定性
/// 默认为 0,如果设置,值域须为 [0, 1] 我们推荐 0.3,以达到较合适的效果
///
public double temperature { get; set; }
///
/// 聊天完成时生成的最大 token 数。如果到生成了最大 token 数个结果仍然没有结束,finish reason 会是 "length", 否则会是 "stop"
/// 这个值建议按需给个合理的值,如果不给的话,我们会给一个不错的整数比如 1024。特别要注意的是,这个 max_tokens 是指您期待我们返回的 token 长度,而不是输入 + 输出的总长度。比如对一个 moonshot-v1-8k 模型,它的最大输入 + 输出总长度是 8192,当输入 messages 总长度为 4096 的时候,您最多只能设置为 4096,否则我们服务会返回不合法的输入参数( invalid_request_error ),并拒绝回答。如果您希望获得“输入的精确 token 数”,可以使用下面的“计算 Token” API 使用我们的计算器获得计数
///
public int? max_tokens { get; set; }
///
/// 另一种采样方法,即模型考虑概率质量为 top_p 的标记的结果。因此,0.1 意味着只考虑概率质量最高的 10% 的标记。一般情况下,我们建议改变这一点或温度,但不建议 同时改变
///
public float? top_p { get; set; } = 1.0f;
///
/// 为每条输入消息生成多少个结果
/// 默认为 1,不得大于 5。特别的,当 temperature 非常小靠近 0 的时候,我们只能返回 1 个结果,如果这个时候 n 已经设置并且 > 1,我们的服务会返回不合法的输入参数(invalid_request_error)
///
public int? n { get; set; } = 1;
///
/// 存在惩罚,介于-2.0到2.0之间的数字。正值会根据新生成的词汇是否出现在文本中来进行惩罚,增加模型讨论新话题的可能性
/// 默认为 0
///
public float? presence_penalty { get; set; } = 0;
///
/// 频率惩罚,介于-2.0到2.0之间的数字。正值会根据新生成的词汇在文本中现有的频率来进行惩罚,减少模型一字不差重复同样话语的可能性
/// 默认为 0
///
public float? frequency_penalty { get; set; } = 0;
///
/// 停止词,当全匹配这个(组)词后会停止输出,这个(组)词本身不会输出。最多不能超过 5 个字符串,每个字符串不得超过 32 字节
/// 默认 null
///
public List? stop { get; set; }
///
/// 是否流式返回
/// false
///
public bool stream { get; set; } = false;
}
public class PermissionItem
{
///
///
///
public int created { get; set; }
///
///
///
public string id { get; set; }
///
///
///
public string @object { get; set; }
///
///
///
public string allow_create_engine { get; set; }
///
///
///
public string allow_sampling { get; set; }
///
///
///
public string allow_logprobs { get; set; }
///
///
///
public string allow_search_indices { get; set; }
///
///
///
public string allow_view { get; set; }
///
///
///
public string allow_fine_tuning { get; set; }
///
///
///
public string organization { get; set; }
///
///
///
public string @group { get; set; }
///
///
///
public string is_blocking { get; set; }
}
public class ChatRes
{
public string id { get; set; }
public int created { get; set; }
///
/// 模型id
///
public string model { get; set; }
///
/// 对话
///
public Choice[] choices { get; set; }
///
/// token使用情况
///
public Usage usage { get; set; }
}
///
/// token使用情况
///
public class Usage
{
///
/// 输入token数量
///
public int prompt_tokens { get; set; }
///
/// 返回token数量
///
public int completion_tokens { get; set; }
///
/// 总计token数量
///
public int total_tokens { get; set; }
}
public class Choice
{
public int index { get; set; }
public Message message { get; set; }
public string finish_reason { get; set; }
}
public class Message
{
public string role { get; set; }
public string content { get; set; }
}
public class ModelInfo
{
///
///
///
public int created { get; set; }
///
///
///
public string id { get; set; }
///
///
///
public string @object { get; set; }
///
///
///
public string owned_by { get; set; }
///
///
///
public List permission { get; set; }
///
///
///
public string root { get; set; }
///
///
///
public string parent { get; set; }
}
public class ModelListResp
{
///
///
///
public string @object { get; set; }
///
///
///
public List data { get; set; }
}
public class FileListResp
{
///
///
///
public string @object { get; set; }
///
///
///
public List data { get; set; }
}
public class FileContent
{
///
///
///
public string content { get; set; }
///
///
///
public string file_type { get; set; }
///
///
///
public string filename { get; set; }
///
///
///
public string title { get; set; }
///
///
///
public string type { get; set; }
}
public class FileItem
{
///
///
///
public string id { get; set; }
///
///
///
public string @object { get; set; }
///
///
///
public int bytes { get; set; }
///
///
///
public int created_at { get; set; }
///
///
///
public string filename { get; set; }
///
///
///
public string purpose { get; set; }
///
///
///
public string status { get; set; }
///
///
///
public string status_details { get; set; }
}
public class ErrorMsg
{
///
///
///
public string message { get; set; }
///
///
///
public string type { get; set; }
}
public class ErrorResponse
{
///
///
///
public ErrorMsg error { get; set; }
}
}