220 lines
5.8 KiB
TypeScript
220 lines
5.8 KiB
TypeScript
import { SettingComponentProps } from '@janhq/core'
|
|
|
|
export const presetConfiguration: Record<string, SettingComponentProps> = {
|
|
prompt_template: {
|
|
key: 'prompt_template',
|
|
title: 'Prompt template',
|
|
description: `A structured format that guides how the model should respond.`,
|
|
controllerType: 'input',
|
|
controllerProps: {
|
|
placeholder: 'Prompt template',
|
|
value: '',
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
stop: {
|
|
key: 'stop',
|
|
title: 'Stop',
|
|
description: `Defines tokens or phrases that will end the model's response.`,
|
|
controllerType: 'tag',
|
|
controllerProps: {
|
|
placeholder: 'Enter stop words',
|
|
value: [''],
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
ctx_len: {
|
|
key: 'ctx_len',
|
|
title: 'Context Length',
|
|
description: `Controls how much text the model can consider at once. Longer context allows the model to handle more input but uses more memory and runs slower.`,
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 128,
|
|
max: 4096,
|
|
step: 128,
|
|
value: 4096,
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
max_tokens: {
|
|
key: 'max_tokens',
|
|
title: 'Max Tokens',
|
|
description: `Controls response length. Higher values allow longer, more detailed responses.`,
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 100,
|
|
max: 4096,
|
|
step: 10,
|
|
value: 4096,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
ngl: {
|
|
key: 'ngl',
|
|
title: 'Number of GPU layers (ngl)',
|
|
description: 'Controls how many layers of the model run on GPU. More layers means faster processing, but requires more GPU memory.',
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 1,
|
|
max: 100,
|
|
step: 1,
|
|
value: 100,
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
embedding: {
|
|
key: 'embedding',
|
|
title: 'Embedding',
|
|
description: 'Whether to enable embedding.',
|
|
controllerType: 'checkbox',
|
|
controllerProps: {
|
|
value: true,
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
stream: {
|
|
key: 'stream',
|
|
title: 'Stream',
|
|
description: `Enables real-time response streaming.`,
|
|
controllerType: 'checkbox',
|
|
controllerProps: {
|
|
value: false,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
temperature: {
|
|
key: 'temperature',
|
|
title: 'Temperature',
|
|
description: `Controls response randomness. Higher values produce more creative, varied responses. `,
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 0,
|
|
max: 2,
|
|
step: 0.1,
|
|
value: 0.7,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
frequency_penalty: {
|
|
key: 'frequency_penalty',
|
|
title: 'Frequency Penalty',
|
|
description: `Reduces word repetition. Higher values encourage more varied language. Useful for creative writing and content generation.`,
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 0,
|
|
max: 1,
|
|
step: 0.1,
|
|
value: 0.7,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
presence_penalty: {
|
|
key: 'presence_penalty',
|
|
title: 'Presence Penalty',
|
|
description: `Encourages the model to explore new topics. Higher values help prevent the model from fixating on already-discussed subjects.`,
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 0,
|
|
max: 1,
|
|
step: 0.1,
|
|
value: 0.7,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
top_p: {
|
|
key: 'top_p',
|
|
title: 'Top P',
|
|
description: `Set probability threshold for more relevant outputs. Higher values allow more diverse word choices.`,
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 0,
|
|
max: 1,
|
|
step: 0.1,
|
|
value: 0.95,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
cpu_threads: {
|
|
key: 'cpu_threads',
|
|
title: 'CPU Threads',
|
|
description:
|
|
'Controls how many CPU cores are used for processing. Higher values can speed up model loading but use more system resources.',
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 0,
|
|
max: 128,
|
|
step: 1,
|
|
value: 1,
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
// assistant
|
|
chunk_size: {
|
|
key: 'chunk_size',
|
|
title: 'Chunk Size',
|
|
description: 'Sets the maximum number of tokens per data chunk. Increase size for processing large blocks of text efficiently, or decrease it to optimize memory usage.',
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 128,
|
|
max: 2048,
|
|
step: 128,
|
|
value: 1024,
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
chunk_overlap: {
|
|
key: 'chunk_overlap',
|
|
title: 'Chunk Overlap',
|
|
description: 'How many words overlap between text segments. More overlap helps maintain meaning across splits.',
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 32,
|
|
max: 512,
|
|
step: 32,
|
|
value: 64,
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
top_k: {
|
|
key: 'top_k',
|
|
title: 'Top K',
|
|
description: 'Number of most relevant documents to retrieve. Higher values return more results.',
|
|
controllerType: 'slider',
|
|
controllerProps: {
|
|
min: 1,
|
|
max: 5,
|
|
step: 1,
|
|
value: 2,
|
|
},
|
|
requireModelReload: false,
|
|
configType: 'runtime',
|
|
},
|
|
retrieval_template: {
|
|
key: 'retrieval_template',
|
|
title: 'Retrieval Template',
|
|
description:
|
|
'Format for how the AI uses context to answer questions.',
|
|
controllerType: 'input',
|
|
controllerProps: {
|
|
placeholder: 'Retrieval Template',
|
|
value: '',
|
|
},
|
|
requireModelReload: true,
|
|
configType: 'setting',
|
|
},
|
|
}
|