custom_models=$(ollama list | grep 'custom-model-prefix')
printf"%b\n""${YELLOW}Please select a model to run:${RC}"
printf"%b\n""${YELLOW}Enter the number corresponding to the model or enter the name of a custom model:${RC}"
read -r model_choice
model=$(select_model "$model_choice")
printf"%b\n""${YELLOW}Running the model: $model...${RC}"
ollama run "$model"
}
create_model(){
clear
printf"%b\n""${YELLOW}Let's create a new model in Ollama!${RC}"
display_models
# Prompt for base model
printf"%b\n""${YELLOW}Enter the base model (e.g. '13' for codellama):${RC}"
read -r base_model
model=$(select_model "$base_model")
printf"%b\n""${YELLOW}Running the model: $model...${RC}"
ollama pull "$model"
# Prompt for custom model name
printf"%b\n""${YELLOW}Enter a name for the new customized model:${RC}"
read -r custom_model_name
# Prompt for temperature setting
printf"%b\n""${YELLOW}Enter the desired temperature (higher values are more creative, lower values are more coherent, e.g., 1):${RC}"
read -r temperature
if[ -z "$temperature"];then
temperature=${temperature:-1}
fi
# Prompt for system message
printf"%b\n""${YELLOW}Enter the system message for the model customization (e.g., 'You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.'):${RC}"
read -r system_message
# Create the Modelfile
printf"%b\n""${YELLOW}Creating the Modelfile...${RC}"
cat << EOF > Modelfile
FROM $base_model
# set the temperature to $temperature
PARAMETER temperature $temperature
# set the system message
SYSTEM """
$system_message
"""
EOF
# Create the model in Ollama
printf"%b\n""${YELLOW}Creating the model in Ollama...${RC}"
ollama create "$custom_model_name" -f Modelfile
printf"%b\n""${GREEN}Model '$custom_model_name' created successfully.${RC}"
}
# Function to remove a model
remove_model(){
clear
printf"%b\n""${GREEN}Installed Models${RC}"
installed_models=$(ollama list)
printf"%b\n""${installed_models}"
printf"%b\n""${YELLOW}Please select a model to remove:${RC}"
printf"%b\n""${YELLOW}Enter the name of the model you want to remove:${RC}"