ドキュメント
エージェントフロー
インテグレーション
テキスト埋め込み
トークン化
モデル情報
エージェントフロー
インテグレーション
テキスト埋め込み
トークン化
モデル情報
インテグレーション
カスタム設定
プラグインサポートは現在プライベートベータ版です。こちらからベータ版に参加してください。
ctl.getPluginConfig および ctl.getGlobalPluginConfig を介してカスタム設定にアクセスできます。詳細については、カスタム設定を参照してください。
specialInstructions と triggerWord を設定可能にする方法の例を以下に示します。
config.ts に設定フィールドを追加します。
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"specialInstructions",
"string",
{
displayName: "Special Instructions",
subtitle: "Special instructions to be injected when the trigger word is found.",
},
"Here is some default special instructions.",
)
.field(
"triggerWord",
"string",
{
displayName: "Trigger Word",
subtitle: "The word that will trigger the special instructions.",
},
"@init",
)
.build();
この例では、「チャットごと」の設定である configSchematics にフィールドを追加しました。異なるチャット間で共有されるグローバル設定フィールドを追加したい場合は、同じファイルの globalConfigSchematics セクションの下に追加してください。
カスタム設定 で設定についてさらに学ぶことができます。
次に、プロンプトプリプロセッサを修正して設定を使用します。
import { type PromptPreprocessorController, type ChatMessage } from "@lmstudio/sdk";
import { configSchematics } from "./config";
export async function preprocess(ctl: PromptPreprocessorController, userMessage: ChatMessage) {
const textContent = userMessage.getText();
const pluginConfig = ctl.getPluginConfig(configSchematics);
const triggerWord = pluginConfig.get("triggerWord");
const specialInstructions = pluginConfig.get("specialInstructions");
const transformed = textContent.replaceAll(triggerWord, specialInstructions);
return transformed;
}
このページのソースは GitHub で入手できます。