Gen reply
ReplyGeneratorCogs
Bases: Cog
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Bot
|
The bot instance. |
required |
Methods:
Name | Description |
---|---|
oai |
Generate a reply based on the user's prompt. |
Source code in src/cogs/gen_reply.py
oai
oai(
interaction: Interaction,
prompt: str = SlashOption(
description="Enter your prompt.",
description_localizations={
Locale.zh_TW: "請輸入提示詞。",
Locale.ja: "プロンプトを入力してください。",
},
),
model: str = SlashOption(
description="Choose a model (default: GPT-4.1).",
description_localizations={
Locale.zh_TW: "選擇模型 (預設為 GPT-4.1)",
Locale.ja: "モデルを選択してください(デフォルトは GPT-4.1)",
},
choices=MODEL_CHOICES,
required=False,
default="gpt-4.1",
),
stream: bool = SlashOption(
description="Enable streaming response (default: False).",
description_localizations={
Locale.zh_TW: "啟用串流回應 (預設為 False)",
Locale.ja: "ストリーミング応答を有効にする(デフォルト: False)",
},
required=False,
default=False,
),
image: Optional[Attachment] = SlashOption(
description="(Optional) Upload an image.",
description_localizations={
Locale.zh_TW: "(可選)上傳一張圖片。",
Locale.ja: "(オプション)画像をアップロードしてください。",
},
required=False,
),
) -> None
Generate a reply based on the user's prompt.
If the model 'o1' is selected along with an image, an error message is returned since 'o1' does not support image input. The function can either generate a complete response or stream the response in real-time based on the stream parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Interaction
|
The interaction object for the command. |
required |
|
str
|
The prompt text provided by the user. |
SlashOption(description='Enter your prompt.', description_localizations={zh_TW: '請輸入提示詞。', ja: 'プロンプトを入力してください。'})
|
|
str
|
The selected model, defaults to "gpt-4.1" if not specified. |
SlashOption(description='Choose a model (default: GPT-4.1).', description_localizations={zh_TW: '選擇模型 (預設為 GPT-4.1)', ja: 'モデルを選択してください(デフォルトは GPT-4.1)'}, choices=MODEL_CHOICES, required=False, default='gpt-4.1')
|
|
bool
|
Whether to stream the response in real-time, defaults to False. |
SlashOption(description='Enable streaming response (default: False).', description_localizations={zh_TW: '啟用串流回應 (預設為 False)', ja: 'ストリーミング応答を有効にする(デフォルト: False)'}, required=False, default=False)
|
|
Optional[Attachment]
|
An optional image attachment uploaded by the user. |
SlashOption(description='(Optional) Upload an image.', description_localizations={zh_TW: '(可選)上傳一張圖片。', ja: '(オプション)画像をアップロードしてください。'}, required=False)
|
Source code in src/cogs/gen_reply.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|