Class ChatGptRequestOptions

信息

表示 Documentize.PdfManager 插件的选项。

public class ChatGptRequestOptions : PluginBaseOptions, IPluginOptions

继承

objectPluginBaseOptionsChatGptRequestOptions

实现

继承成员

构造函数

ChatGptRequestOptions()

使用默认选项初始化 Documentize.ChatGptRequestOptions 对象的新实例。

public ChatGptRequestOptions()

ChatGptRequestOptions(string, string, string, string)

使用指定选项初始化 Documentize.ChatGptRequestOptions 对象的新实例。

public ChatGptRequestOptions(string apiKey, string model, string apiUrl, string query)

参数

  • apiKey string: 访问 ChatGPT API 的密钥。
  • model string: ChatGPT 模型的名称。默认模型为:gpt-3.5-turbo-1106。
  • apiUrl string: ChatGPT API 的 URL。默认 URL 为:https://api.openai.com/v1/chat/completions。
  • query string: 发送给 ChatGPT 的请求字符串。

属性

ApiKey

获取或设置访问 ChatGPT API 的密钥。

public string ApiKey { get; set; }

属性值

string

ApiUrl

获取或设置 ChatGPT API 的 URL。

public string ApiUrl { get; set; }

属性值

string

CancellationToken

取消令牌。

public CancellationToken CancellationToken { get; set; }

属性值

CancellationToken

MaxTokens

响应中最大 token 数。默认值为 null,表示无限制。

public int? MaxTokens { get; set; }

属性值

int?

Messages

获取或设置 Documentize.Message 对象的集合。

public List<message> Messages { get; set; }

属性值

List<Message>

备注

向选项中添加多个消息时,集合中的顺序如下:

  • 第一个消息(如果有)来自 options.Query,其前置消息内容为 “You are a helpful assistant.”,角色为 “system”。
  • 接着(如果有)添加 options.Messages 集合中的消息。
  • 来自文件源的消息(如果有)最后添加,每个文档对应一个角色为 “user” 的消息对象。
    如果未提供任何消息,将抛出 ArgumentException

Model

设置或获取要使用的模型 ID。

public string Model { get; set; }

属性值

string

NumberOfChoices

为每条输入消息生成的聊天完成选项数量。

public int NumberOfChoices { get; set; }

属性值

int

Query

获取或设置发送给 ChatGPT 的请求字符串。若非空,则此字符串为集合中的第一条消息,随请求一起发送。

public string Query { get; set; }

属性值

string

Temperature

采样温度,取值范围 0 到 2。值越高(例如 0.8)输出越随机,值越低(例如 0.2)输出越集中且确定。默认值为 1。

public double Temperature { get; set; }

属性值

double

命名空间: Documentize
程序集: Documentize.dll

 中文