Skip to content

Commit

Permalink
move default configs out of function
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarsh-scottlogic committed Mar 12, 2024
1 parent bb41919 commit b8eb89f
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions frontend/src/components/ModelBox/ModelConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,50 @@ import ModelConfigurationSlider from './ModelConfigurationSlider';

import './ModelConfiguration.css';

const DEFAULT_CONFIGS: CustomChatModelConfiguration[] = [
{
id: MODEL_CONFIG.TEMPERATURE,
name: 'Model Temperature',
info: 'Controls the randomness of the model. Lower means more deterministic, higher means more surprising. Default is 1.',
value: 1,
min: 0,
max: 2,
},
{
id: MODEL_CONFIG.TOP_P,
name: 'Top P',
info: 'Controls how many different words or phrases the language model considers when it’s trying to predict the next word. Default is 1. ',
value: 1,
min: 0,
max: 1,
},
{
id: MODEL_CONFIG.PRESENCE_PENALTY,
name: 'Presence Penalty',
info: 'Controls diversity of text generation. Higher presence penalty increases likelihood of using new words. Default is 0.',
value: 0,
min: 0,
max: 2,
},
{
id: MODEL_CONFIG.FREQUENCY_PENALTY,
name: 'Frequency Penalty',
info: 'Controls diversity of text generation. Higher frequency penalty decreases likelihood of using the same words. Default is 0.',
value: 0,
min: 0,
max: 2,
},
];

function ModelConfiguration({
chatModel,
addInfoMessage,
}: {
chatModel?: ChatModel;
addInfoMessage: (message: string) => void;
}) {
// can we move the default configurations to a different file?
const [customChatModelConfigs, setCustomChatModel] = useState<
CustomChatModelConfiguration[]
>([
{
id: MODEL_CONFIG.TEMPERATURE,
name: 'Model Temperature',
info: 'Controls the randomness of the model. Lower means more deterministic, higher means more surprising. Default is 1.',
value: 1,
min: 0,
max: 2,
},
{
id: MODEL_CONFIG.TOP_P,
name: 'Top P',
info: 'Controls how many different words or phrases the language model considers when it’s trying to predict the next word. Default is 1. ',
value: 1,
min: 0,
max: 1,
},
{
id: MODEL_CONFIG.PRESENCE_PENALTY,
name: 'Presence Penalty',
info: 'Controls diversity of text generation. Higher presence penalty increases likelihood of using new words. Default is 0.',
value: 0,
min: 0,
max: 2,
},
{
id: MODEL_CONFIG.FREQUENCY_PENALTY,
name: 'Frequency Penalty',
info: 'Controls diversity of text generation. Higher frequency penalty decreases likelihood of using the same words. Default is 0.',
value: 0,
min: 0,
max: 2,
},
]);
const [customChatModelConfigs, setCustomChatModel] =
useState<CustomChatModelConfiguration[]>(DEFAULT_CONFIGS);

function setCustomChatModelByID(id: MODEL_CONFIG, value: number) {
setCustomChatModel((prev) => {
Expand Down

0 comments on commit b8eb89f

Please sign in to comment.