Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new command change_model: #152

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ This script relies on curl for the requests to the api and jq to parse the json
- `history` To view your chat history, type `history`
- `models` To get a list of the models available at OpenAI API, type `models`
- `model:` To view all the information on a specific model, start a prompt with `model:` and the model `id` as it appears in the list of models. For example: `model:text-babbage:001` will get you all the fields for `text-babbage:001` model
- `change_model`: To change the used model type, type `change_model:` and the model `id`. For example `change_model:gpt-4` will change the current model to gpt-4
- `command:` To get a command with the specified functionality and run it, just type `command:` and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e. `command: show me all files in this directory that have more than 150 lines of code`
*If a command modifies your file system or dowloads external files the script will show a warning before executing.*

Expand Down
5 changes: 4 additions & 1 deletion chatgpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Commands:
history - To view your chat history
models - To get a list of the models available at OpenAI API
model: - To view all the information on a specific model, start a prompt with model: and the model id as it appears in the list of models. For example: "model:text-babbage:001" will get you all the fields for text-babbage:001 model
command: - To get a command with the specified functionality and run it, just type "command:" and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e.
change_model: - To change the used model. For example "change_model:gpt-4" will change the current model to gpt-4
command: - To get a command with the specified functionality and run it, just type "command:" and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e.
"command: show me all files in this directory that have more than 150 lines of code"
*If a command modifies your file system or dowloads external files the script will show a warning before executing.

Expand Down Expand Up @@ -374,6 +375,8 @@ while $running; do
model_data=$(echo $models_response | jq -r -C '.data[] | select(.id=="'"${prompt#*model:}"'")')
echo -e "$OVERWRITE_PROCESSING_LINE"
echo -e "${CHATGPT_CYAN_LABEL}Complete details for model: ${prompt#*model:}\n ${model_data}"
elif [[ "$prompt" =~ ^change_model: ]]; then
MODEL=${prompt#*change_model:}
elif [[ "$prompt" =~ ^command: ]]; then
# escape quotation marks, new lines, backslashes...
escaped_prompt=$(escape "$prompt")
Expand Down