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

Namespace: Documentize Assembly: Documentize.dll

 中文