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

4.2.1. Code tasks

Key binding Command Description
SPC $ ec c ellama-code-complete Complete code in current buffer
SPC $ ec a ellama-code-add Add code according to description
SPC $ ec e ellama-code-edit Edit code according to change
SPC $ ec i ellama-code-improve Improve code
SPC $ ec r ellama-code-review Review code

4.2.2. Summarization tasks

Key binding Command Description
SPC $ es s ellama-summarize Summarize selected region or buffer
SPC $ es w ellama-summarize-webpage Summarize webpage
SPC $ es c ellama-summarize-killring Summarize text from kill ring

4.2.3. Edit tasks

Key binding Command Description
SPC $ ei c ellama-complete Complete text in current buffer
SPC $ ei w ellama-improve-wording Improve wording
SPC $ ei g ellama-improve-grammar Improve grammar
SPC $ ei s ellama-improve-conciseness Shorten text (make concise)
SPC $ ei l ellama-make-list Create markdown list
SPC $ ei t ellama-make-table Create markdown table
SPC $ ei f ellama-make-format Render text as specified format

4.2.4. Question-Answering tasks

Key binding Command Description
SPC $ ea a ellama-ask-about Ask about selected region or buffer
SPC $ ea c ellama-chat Chat with ellama
SPC $ ea i ellama-instant Prompt ellama for instant reply
SPC $ ea l ellama-ask-line Send current line to ellama
SPC $ ea s ellama-ask-selection Send selected region to ellama

4.2.5. Problem solving tasks

Key binding Command Description
SPC $ ep r ellama-solve-reasoning-problem Solve reasoning PROBLEM with abstraction of thought
SPC $ ep d ellama-solve-domain-specific-problem Solve domain-specific PROBLEM

4.2.6. Translation tasks

Key binding Command Description
SPC $ et t ellama-translate Translate selected region or word at point
SPC $ et b ellama-translate-buffer Translate current buffer
SPC $ et e ellama-chat-translation-enable Enable chat translation
SPC $ et d ellama-chat-translation-disable Disable chat translation

4.2.7. Thesaurus tasks

Key binding Command Description
SPC $ ed w ellama-define-word Define current word

4.2.8. Context management

Key binding Command Description
SPC $ ex b ellama-context-add-buffer Add buffer to context
SPC $ ex f ellama-context-add-file Add file to context
SPC $ ex s ellama-context-add-selection Add selection to context
SPC $ ex i ellama-context-add-info-node Add info node to context

4.2.9. Session management

Key binding Command Description
SPC $ eS l ellama-load-session Load ellama session
SPC $ eS r ellama-session-rename Rename ellama session
SPC $ eS d ellama-session-remove Remove ellama session
SPC $ eS a ellama-session-switch Switch ellama session

4.2.10. Provider management

Key binding Command Description
SPC $ ep s ellama-provider-select Select ellama provider

Author: root

Created: 2024-11-15 Fri 04:05

Validate