Skip to content

karthink/gptel-quick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

gptel-quick: Quick LLM lookups in Emacs

gptel-quick is a tiny everyday helper for easily looking up or summarizing text using an LLM (Large Language Model).

It provides one command. Call gptel-quick to show a short summary or explanation of the word at point, or an active region, in a popup. This is useful for quickly looking up names, words, phrases, or summarizing/explaining prose or snippets of code, with minimal friction:

gptel-quick-simple.webm

When the popup is active,

  • press + to get a longer summary,
  • M-w (or kill-ring-save) to copy the response,
  • or C-g (or keyboard-quit) to clear it.

(You probably want to bind it to a key instead of having to M-x gptel-quick, see Setup below for suggestions.)

You can press + multiple times.

Looking up a word in progressively more detail before copying the response:

gptel-quick-make-longer.webm

It works with PDFs if you use pdf-tools in Emacs:

gptel-quick-pdf-example.webm

Explaining what a function does:

gptel-quick-explain-function.webm

Finally, if you have follow-up questions you can switch to a chat buffer and continue the conversation with M-RET:

Screencast_20240627_021108.webm

If the posframe package (optional) is not installed, the response is messaged to the echo area instead.

You can control the response word count (approximate) via gptel-quick-word-count, and the popup timeout via gptel-quick-timeout.

Set gptel-quick-use-context if you have added context to gptel (other regions, buffers or files) and want that to be included in the queries.

Setup

This package requires gptel and access to any LLM via gptel to be available. See its README for details. The above examples were with different LLMs – Claude 3 Haiku, Llama3-70b and ChatGPT 3.5 respectively.

Install this package however you install packages, either via straight/elpaca/quelpa, or the built-in package-vc-install, or by cloning this repo and running package-install=file on the repository directory.

Once installed, you can call gptel-quick at any time on a word/region.

It might be useful to add this command as an Embark action if you use Embark:

(keymap-set embark-general-map "?" #'gptel-quick)

You can set it in embark-region-map and embark-identifier-map instead of embark-general-map if you only want it available at certain times.

Notes

This small package is intended as a demonstration of gptel-request, gptel’s general purpose API for constructing prompts and querying LLMs from Emacs.

About

Quick LLM lookups in Emacs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published