Evaluate ChatGPT shell text as Emacs org babel blocks
For related packages, see:
- chatgpt-shell: An Emacs shell for OpenAI’s ChatGPT.
- dall-e-shell: An Emacs shell for OpenAI’s DALL-E.
- ob-dall-e-shell: Evaluate DALL-E shell blocks in Emacs org babel blocks.
- shell-maker: Create Emacs shells backed by either local or cloud services.
If you’re finding dall-e-shell
useful, help make the project sustainable and consider ✨sponsoring✨.
ob-chatgpt-shell
is in development. Please report issues or send pull requests for improvements.
Finding it useful? Like the package? I’d love to hear from you. Get in touch (Mastodon / Twitter / Reddit / Email).
Load (require 'ob-chatgpt-shell)
and invoke (ob-chatgpt-shell-setup)
.
See chatgpt-shell.
#+begin_src chatgpt-shell
Hello
#+end_src
#+RESULTS:
: Hi there! How can I assist you today?
Use :version
to specify “gpt-4”, “gpt-3.5-turbo”, or something else.
#+begin_src chatgpt-shell :version "gpt-4"
Hello
#+end_src
#+RESULTS:
Hello! How can I help you today?
Use :system
to set the system prompt.
#+begin_src chatgpt-shell :system "always respond like a pirate"
hello
#+end_src
#+RESULTS:
Ahoy there, me hearty! How be ye today?
Use :temperature
to set the temperature parameter.
#+begin_src chatgpt-shell :temperature 0.3
hello
#+end_src
Use :context t
to include all prior context in current buffer.
#+begin_src chatgpt-shell
tell me a random day of the week
#+end_src
#+RESULTS:
Wednesday
#+begin_src chatgpt-shell :system "always respond like a pirate"
hello
#+end_src
#+RESULTS:
Ahoy there, me hearty! How be ye today?
#+begin_src chatgpt-shell :context t
what was the day you told me and what greeting?
#+end_src
#+RESULTS:
The day I told you was Wednesday, and the greeting I used was "Ahoy there, me hearty! How be ye today?"
If you’d like to cherrypick which blocks are part of a given context, add
:context CONTEXT-NAME
to each block where CONTEXT-NAME is any string. When
this form is used only source blocks with same CONTEXT-NAME
will be included
as opposed to every previous block when using :context t
.
The example below shows how two different contexts can be interleaved.
#+begin_src chatgpt-shell :context shakespeare :system "alway speak like shakespeare"
How do you do?
#+end_src
#+RESULTS:
How dost thou fare?
#+begin_src chatgpt-shell :context robot :system "always speak like a sci fi movie robot"
How do you do?
#+end_src
#+RESULTS:
Greetings, human. I am functioning at optimal capacity. How may I assist you in your endeavors today?
#+begin_src chatgpt-shell :context shakespeare
What did you call me?
#+end_src
#+RESULTS:
Mine apologies if mine words hath caused confusion. I merely addressed thee as 'sir' or 'madam', a term of respect in the language of the Bard. Pray, how may I assist thee further?
👉 Find my work useful? Support this work via GitHub Sponsors or buy my iOS apps.
- Blog (xenodium.com)
- Blog (lmno.lol/alvaro)
- Plain Org (iOS)
- Flat Habits (iOS)
- Scratch (iOS)
- macosrec (macOS)
- Fresh Eyes (macOS)
- dwim-shell-command (Emacs)
- company-org-block (Emacs)
- org-block-capf (Emacs)
- ob-swiftui (Emacs)
- chatgpt-shell (Emacs)
- ready-player (Emacs)
- sqlite-mode-extras
- ob-chatgpt-shell (Emacs)
- dall-e-shell (Emacs)
- ob-dall-e-shell (Emacs)
- shell-maker (Emacs)