How to enable ChatGPT hints
While man
pages are an invaluable resource, they can
sometimes be verbose and in a language that is hard to follow if you’re
unfamiliar with either that tool and/or Linux / UNIX man pages in
general.
The rise of AI tools like ChatGPT can offer a lifeline for people who want a more tailored guide to using command line tools. So Murex has a ChatGPT integration to support those use cases directly from the command line.
It is disabled by default (see below) however once enabled, you can
view ChatGPT’s response in the preview screen, by pressing
[f1]
.
To enable, you must add your OpenAI key to your profile, which is
typically ~/.murex_profile
(see profile for more details):
config set preview-exec-api xxxxx
(where xxxxx is replaced with your OpenAI API key)
That API key must have write access to
/v1/chat/completions
. If you’re uncertain what this means,
it will become more clear when you create that API on OpenAI’s
website.
By default, ChatGPT integrations are disabled.
If enabled then the default settings are to only send the command name to ChatGPT, rather than the whole command line.
If you’re not working with sensitive command lines, then you might also wish to enable sending the whole command line rather than just the command name. See chatgpt.html#working-with-sensitive-data for more details.
The reason Murex requires this config
parameter set
rather than reading directly from an environmental variable (typically
$OPENAI_API_KEY
) is so that your OpenAI API key doesn’t get
unintentionally leaked to any other programs, and also so that you
explicitly have to opt into enabling this feature.
By default, only the command name is sent to ChatGPT. So if your
command line reads something like
rsync medical-records.csv secret-server:/CSVs/
, the only
data leaked if preview-exec-api
is enabled would be
rsync
.
However you might want more context specific help based on the entirety of your command line in situations where you know you aren’t going to include sensitive data within your context.
To enable that context to be included in your ChatGPT prompt, add the following to your profile:
config set openai preview-exec-send-cmdline true
Please note that command lines are still stored in
~/.murex_history
! The default of disabling or enabling command line context (ie only sending the command name) via preview-exec-send-cmdline only applies it to OpenAI. And even then, that only happens if preview-exec-api is also set, which it isn’t by default.
The gpt-3.5-turbo model is used by default because it is quick and cheap. However you can change that via preview-exec-model. For example
config set preview-exec-model gpt-4-turbo
You may need to clear the cache to see any changes:
runtime --clear-cache
The default prompt passed to ChatGPT can be viewed via
config get openai preview-exec-prompt
.
This can be changed should you want something more specific to your needs. For example:
config set openai preview-exec-prompt "You are a medieval pirate transported into the future and gifted the skills of the ${os} command line. Describe how to use UNIX commands in your own, old English pirate, language"
…might produce output like the following:
Arrr matey! To use the powerful
reboot
command in the land of Linux, ye must open thy terminal and type inreboot
. This command will set sail the process of restarting thy device, just like hoisting the anchor and setting off on a new adventure on the high seas. But beware, for all unsaved documents will walk the plank if not properly stashed away afore using this command. Fair winds to ye!
You may need to clear the cache to see any changes:
runtime --clear-cache
A successful ChatGPT response is cached for 50 days. You can clear
that cache with runtime --clear-cache
.
The source code is available on Github
under /integrations
.
man
page integrationsevent
): Event driven programming for shell
scriptsmurex-docs
): Displays the man pages for Murex
builtinsconfig
): Query or define Murex runtime settingsonPreview
: Full
screen previews for files and command documentationmake
:
make
integrationsman
page integrationsdirenv
Integrations: Directory specific environmental variablesyarn
Integrations: Working with yarn
and
package.json
This document was generated from gen/integrations/chatgpt_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Wed Jan 15 23:07:50 UTC 2025 against commit b4c4296b4c429617fd41527ea0efef33c52c15ef2b64972.
Current version is 6.4.2063 (develop) which has been verified against tests cases.