Table of Contents

Large Language Model Client layer

Table of ContentsClose

1. Description

This layer enables usage of GPT Clients in Spacemacs using GPTel and Ellama.

1.1. Features:

You will have access to the following tools:

  • ChatGPT
  • Azure
  • Ollama
  • GPT4All
  • Gemini
  • Llama.cpp
  • Llamafile
  • Kagi FastGPT
  • Kagi Summarizer
  • together.ai
  • Anyscale
  • Perplexity
  • Anthropic (Claude)
  • Groq

2. Install

2.1. Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add llm-client to the existing dotspacemacs-configuration-layers list in this file.

2.2. GPTel support

GPTel is a Large Language Model chat client for Emacs, with support for multiple models and backends. GPTel allows you to interact with LLMs from anywhere in Emacs (any buffer, shell, minibuffer, wherever) and supports conversations and multiple independent sessions.

Key features of GPTel include:

  • Async and fast, streams responses.
  • LLM responses are in Markdown or Org markup.
  • Supports conversations and multiple independent sessions.
  • Save chats as regular Markdown/Org/Text files and resume them later.

To enable GPTel support in your Spacemacs configuration, add the following to your dotspacemacs-configuration-layers list:

(setq-default dotspacemacs-configuration-layers
 '((llm-client :variables llm-client-enable-gptel t)))

2.3. Ellama support

Ellama is a tool for interacting with large language models from Emacs. It provides a suite of convenience functions that streamline common workflows. Ellama can perform various tasks such as translation, code review, summarization, enhancing grammar/spelling or wording and more through the Emacs interface.

Key features of Ellama include:

  • Easily translate text between different languages.
  • Automatically review and provide feedback on code snippets.
  • Generate concise summaries of lengthy documents or articles.
  • Improve the quality of written content by correcting grammar and spelling errors.
  • Refine and polish text to enhance clarity and readability.

To enable Ellama support in your Spacemacs configuration, add the following to your dotspacemacs-configuration-layers list:

(setq-default dotspacemacs-configuration-layers
 '((llm-client :variables llm-client-enable-ellama t)))

3. Configuration

Refer to the official GPTel and ellama documentation for advanced configurations and additional information.

4. Key bindings

The layer provides several key bindings to interact with LLMs efficiently.

4.1. GPTel

Key binding Command Description
SPC $ g g gptel Start a new GPTel session
SPC $ g s gptel-send Send a message to GPTel
SPC $ g q gptel-abort Abort any active GPTel process
SPC $ g m gptel-menu Open the GPTel menu
SPC $ g c gptel-add Add to context
SPC $ g f gptel-add-file Add a file to context
SPC $ g o gptel-org-set-topic Set topic in Org-mode
SPC $ g p gptel-org-set-properties Set properties in Org-mode

In addition, this layer adds the following key bindings to org-mode

Key binding Command Description
SPC m $ g o gptel-org-set-topic Set topic in Org-mode
SPC m $ g p gptel-org-set-properties Set properties in Org-mode

4.2. Ellama

Ellama provides its own transient key binding menu, which is self-documenting.

Key binding Command Description
SPC $ e ellama-transient-main-menu Show ellama transient state

4.2.1. Transient menu

Only a small subset of the prefixes in the transient menu are documented here. Press SPC $ e to see the full menu.

Key binding Description
a ask about
c chat
C code
d define word
i improve text
s summarize text
t translate text
S add/manage sessions
x add/manage context
p select provider
R solve reasoning problem
D solve domain-specific problem
q quit menu

Author: root

Created: 2025-04-23 Wed 11:22

Validate