diff options
| author | Vineet Kumar <git@vineetk.net> | 2026-04-15 10:56:17 -0400 |
|---|---|---|
| committer | Vineet Kumar <git@vineetk.net> | 2026-04-15 10:59:19 -0400 |
| commit | 88701b4c01498f5bd987f71d01e34eeda4f90e62 (patch) | |
| tree | 4e21973211b0020ceb89011aca7afa893e7fb67e | |
| parent | 6c25a2f8f115ec2d29557ca7731d41ee4866ed1e (diff) | |
emacs: add gptel-agent
| -rw-r--r-- | epistemia/packages/emacs.scm | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/epistemia/packages/emacs.scm b/epistemia/packages/emacs.scm index 0488898..87d8087 100644 --- a/epistemia/packages/emacs.scm +++ b/epistemia/packages/emacs.scm | |||
| @@ -65,3 +65,163 @@ underline style instead of regular underline. (setq kaolin-themes-underline-wave | |||
| 65 | t) ;; When t, will display colored hl-line style (setq | 65 | t) ;; When t, will display colored hl-line style (setq |
| 66 | kaolin-themes-hl-line-colored t).") | 66 | kaolin-themes-hl-line-colored t).") |
| 67 | (license license:gpl3))) | 67 | (license license:gpl3))) |
| 68 | |||
| 69 | (define-public emacs-gptel-new | ||
| 70 | (package | ||
| 71 | (name "emacs-gptel-new") | ||
| 72 | (version "20260410.711") | ||
| 73 | (source | ||
| 74 | (origin | ||
| 75 | (method git-fetch) | ||
| 76 | (uri (git-reference | ||
| 77 | (url "https://github.com/karthink/gptel") | ||
| 78 | (commit "8d6411b5f89d796c817ff79324973b8910e164fe"))) | ||
| 79 | (file-name (git-file-name name version)) | ||
| 80 | (sha256 | ||
| 81 | (base32 "0zl5qdp9qqh8chadsp2m3jpbpsxlywdlfkax8p97y73q1yias0q6")))) | ||
| 82 | (build-system emacs-build-system) | ||
| 83 | (propagated-inputs (list emacs-transient emacs-compat)) | ||
| 84 | (home-page "https://github.com/karthink/gptel") | ||
| 85 | (synopsis "Interact with ChatGPT or other LLMs") | ||
| 86 | (description | ||
| 87 | "gptel is a simple Large Language Model chat client, with support for multiple | ||
| 88 | models and backends. It works in the spirit of Emacs, available at any time and | ||
| 89 | in any buffer. gptel supports: - The services @code{ChatGPT}, Azure, Gemini, | ||
| 90 | Anthropic AI, Together.ai, Perplexity, AI/ML API, Anyscale, @code{OpenRouter}, | ||
| 91 | Groq, @code{PrivateGPT}, @code{DeepSeek}, Cerebras, Github Models, @code{GitHub} | ||
| 92 | Copilot chat, AWS Bedrock, Novita AI, @code{xAI}, Sambanova, Mistral Le Chat and | ||
| 93 | Kagi (@code{FastGPT} & Summarizer). - Local models via Ollama, Llama.cpp, | ||
| 94 | Llamafiles or GPT4All Additionally, any LLM service (local or remote) that | ||
| 95 | provides an @code{OpenAI-compatible} API is supported. Features: - Interact | ||
| 96 | with LLMs from anywhere in Emacs (any buffer, shell, minibuffer, wherever). - | ||
| 97 | LLM responses are in Markdown or Org markup. - Supports conversations and | ||
| 98 | multiple independent sessions. - Supports tool-use to equip LLMs with agentic | ||
| 99 | capabilities. - Supports Model Context Protocol (MCP) integration using the | ||
| 100 | mcp.el package. - Supports multi-modal models (send images, documents). - | ||
| 101 | Supports \"reasoning\" content in LLM responses. - Save chats as regular | ||
| 102 | Markdown/Org/Text files and resume them later. - You can go back and edit your | ||
| 103 | previous prompts or LLM responses when continuing a conversation. These will be | ||
| 104 | fed back to the model. - Redirect prompts and responses easily - Rewrite, | ||
| 105 | refactor or fill in regions in buffers. - Write your own commands for custom | ||
| 106 | tasks with a simple API. Requirements for @code{ChatGPT}, Azure, Gemini or Kagi: | ||
| 107 | - You need an appropriate API key. Set the variable `gptel-api-key to the key | ||
| 108 | or to a function of no arguments that returns the key. (It tries to use | ||
| 109 | `auth-source by default) @code{ChatGPT} is configured out of the box. For the | ||
| 110 | other sources: - For Azure: define a gptel-backend with `gptel-make-azure'. - | ||
| 111 | For Gemini: define a gptel-backend with `gptel-make-gemini'. - For Anthropic | ||
| 112 | (Claude): define a gptel-backend with `gptel-make-anthropic'. - For AI/ML API, | ||
| 113 | Together.ai, Anyscale, Groq, @code{OpenRouter}, @code{DeepSeek}, Cerebras or | ||
| 114 | Github Models: define a gptel-backend with `gptel-make-openai'. - For | ||
| 115 | @code{PrivateGPT}: define a backend with `gptel-make-privategpt'. - For | ||
| 116 | Perplexity: define a backend with `gptel-make-perplexity'. - For Deepseek: | ||
| 117 | define a backend with `gptel-make-deepseek'. - For Kagi: define a gptel-backend | ||
| 118 | with `gptel-make-kagi'. For local models using Ollama, Llama.cpp or GPT4All: - | ||
| 119 | The model has to be running on an accessible address (or localhost) - Define a | ||
| 120 | gptel-backend with `gptel-make-ollama or `gptel-make-gpt4all'. - Llama.cpp or | ||
| 121 | Llamafiles: Define a gptel-backend with `gptel-make-openai'. Consult the | ||
| 122 | package README for examples and more help with configuring backends. Usage: | ||
| 123 | gptel can be used in any buffer or in a dedicated chat buffer. The interaction | ||
| 124 | model is simple: Type in a query and the response will be inserted below. You | ||
| 125 | can continue the conversation by typing below the response. To use this in any | ||
| 126 | buffer: - Call `gptel-send to send the buffer's text up to the cursor. Select a | ||
| 127 | region to send only the region. - You can select previous prompts and responses | ||
| 128 | to continue the conversation. - Call `gptel-send with a prefix argument to | ||
| 129 | access a menu where you can set your backend, model and other parameters, or to | ||
| 130 | redirect the prompt/response. To use this in a dedicated buffer: - M-x gptel: | ||
| 131 | Start a chat session. - In the chat session: Press `C-c RET (`gptel-send') to | ||
| 132 | send your prompt. Use a prefix argument (`C-u C-c RET') to access a menu. In | ||
| 133 | this menu you can set chat parameters like the system directives, active backend | ||
| 134 | or model, or choose to redirect the input or output elsewhere (such as to the | ||
| 135 | kill ring or the echo area). - You can save this buffer to a file. When opening | ||
| 136 | this file, turn on `gptel-mode before editing it to restore the conversation | ||
| 137 | state and continue chatting. - To include media files with your request, you can | ||
| 138 | add them to the context (described next), or include them as links in Org or | ||
| 139 | Markdown mode chat buffers. Sending media is disabled by default, you can turn | ||
| 140 | it on globally via `gptel-track-media', or locally in a chat buffer via the | ||
| 141 | header line. Include more context with requests: If you want to provide the LLM | ||
| 142 | with more context, you can add arbitrary regions, buffers, files or directories | ||
| 143 | to the query with `gptel-add'. To add text or media files, call `gptel-add in | ||
| 144 | Dired or use the dedicated `gptel-add-file'. You can also add context from | ||
| 145 | gptel's menu instead (`gptel-send with a prefix arg), as well as examine or | ||
| 146 | modify context. When context is available, gptel will include it with each LLM | ||
| 147 | query. LLM Tool use: gptel supports \"tool calling\" behavior, where LLMs can | ||
| 148 | specify arguments with which to call provided \"tools\" (elisp functions). The | ||
| 149 | results of running the tools are fed back to the LLM, giving it capabilities and | ||
| 150 | knowledge beyond what is available out of the box. For example, tools can | ||
| 151 | perform web searches or API lookups, modify files and directories, and so on. | ||
| 152 | Tools can be specified via `gptel-make-tool', or obtained from other | ||
| 153 | repositories, or from Model Context Protocol (MCP) servers using the mcp.el | ||
| 154 | package. See the README for details. Tools can be included with LLM queries | ||
| 155 | using gptel's menu, or from `gptel-tools'. Rewrite interface In any buffer: | ||
| 156 | with a region selected, you can rewrite prose, refactor code or fill in the | ||
| 157 | region. This is accessible via `gptel-rewrite', and also from the `gptel-send | ||
| 158 | menu. Presets Define a bundle of configuration (model, backend, system message, | ||
| 159 | tools etc) as a \"preset\" that can be applied together, making it easy to switch | ||
| 160 | between tasks in gptel. Presets can be saved and applied from gptel's transient | ||
| 161 | menu. You can also include a cookie of the form \"@@preset-name\" in the prompt | ||
| 162 | to send a request with a preset applied. This feature works everywhere, but | ||
| 163 | preset cookies are also fontified in chat buffers. gptel in Org mode: gptel | ||
| 164 | offers a few extra conveniences in Org mode: - You can limit the conversation | ||
| 165 | context to an Org heading with `gptel-org-set-topic'. - You can have branching | ||
| 166 | conversations in Org mode, where each hierarchical outline path through the | ||
| 167 | document is a separate conversation branch. See the variable | ||
| 168 | `gptel-org-branching-context'. - You can declare the gptel model, backend, | ||
| 169 | temperature, system message and other parameters as Org properties with the | ||
| 170 | command `gptel-org-set-properties'. gptel queries under the corresponding | ||
| 171 | heading will always use these settings, allowing you to create mostly | ||
| 172 | reproducible LLM chat notebooks. Finally, gptel offers a general purpose API | ||
| 173 | for writing LLM ineractions that suit your workflow. See `gptel-request', and | ||
| 174 | `gptel-fsm for more advanced usage.") | ||
| 175 | (license license:gpl3))) | ||
| 176 | |||
| 177 | (define-public emacs-gptel-agent | ||
| 178 | (package | ||
| 179 | (name "emacs-gptel-agent") | ||
| 180 | (version "20260412.716") | ||
| 181 | (source | ||
| 182 | (origin | ||
| 183 | (method git-fetch) | ||
| 184 | (uri (git-reference | ||
| 185 | (url "https://github.com/karthink/gptel-agent") | ||
| 186 | (commit "bef06bccdbf847e0c4a94d1b57dd96d979437430"))) | ||
| 187 | (file-name (git-file-name name version)) | ||
| 188 | (sha256 | ||
| 189 | (base32 "1g33w8db2g33l3qf4f9vnafkdpilaxh4s9cy76yv79rphg92ipaw")))) | ||
| 190 | (build-system emacs-build-system) | ||
| 191 | (propagated-inputs (list emacs-compat emacs-gptel-new emacs-yaml | ||
| 192 | emacs-orderless)) | ||
| 193 | (arguments | ||
| 194 | '(#:include '("^[^/]*.el$" "^[^/]*.el.in$" | ||
| 195 | "^dir$" | ||
| 196 | "^[^/]*.info$" | ||
| 197 | "^[^/]*.texi$" | ||
| 198 | "^[^/]*.texinfo$" | ||
| 199 | "^doc/dir$" | ||
| 200 | "^doc/[^/]*.info$" | ||
| 201 | "^doc/[^/]*.texi$" | ||
| 202 | "^doc/[^/]*.texinfo$" | ||
| 203 | "^agents$") | ||
| 204 | #:exclude '("^.dir-locals.el$" "^test.el$" "^tests.el$" | ||
| 205 | "^[^/]*-test.el$" "^[^/]*-tests.el$"))) | ||
| 206 | (home-page "https://github.com/karthink/gptel-agent") | ||
| 207 | (synopsis "Agentic LLM use for gptel") | ||
| 208 | (description | ||
| 209 | "This is a collection of tools and prompts to use gptel \"agentically\" with any | ||
| 210 | LLM, to autonomously perform tasks. It has access to - the web (via basic web | ||
| 211 | search, URL fetching and @code{YouTube} video metadata), - local files | ||
| 212 | (read/write/edit), - the state of Emacs (documentation and Elisp evaluation), - | ||
| 213 | and Bash, if you are in a POSIX-y environment. To use gptel-agent in a | ||
| 214 | dedicated buffer: - Set `gptel-model and `gptel-backend to use your preferred | ||
| 215 | LLM. - Run M-x `gptel-agent'. This will open a buffer with the agent preset | ||
| 216 | loaded. - Use gptel as usual, calling `gptel-send etc. - If you change the | ||
| 217 | system prompt, tools or other settings in this buffer, you can reset the agent | ||
| 218 | state by (re)applying the \"gptel-agent\" preset from gptel's menu. To use | ||
| 219 | gptel-agent anywhere in Emacs: - As with gptel, you can use gptel-agent in any | ||
| 220 | buffer. Just apply the \"gptel-agent\" preset in the buffer, or include | ||
| 221 | \"@@gptel-agent\" in a prompt. gptel-agent can delegate tasks to \"sub-agents\". | ||
| 222 | Sub-agents can be specified in Markdown or Org files in a directory. To see how | ||
| 223 | to specify agents, examine the \"agents\" directory in this package. You can add | ||
| 224 | your directory of agents to `gptel-agent-dirs', which see. Please note: | ||
| 225 | gptel-agent uses significantly more tokens than the average gptel LLM | ||
| 226 | interaction.") | ||
| 227 | (license license:gpl3))) | ||
