GNU-devel ELPA - ellama

ellama Atom Feed

Tool for interacting with LLMs
ellama- (.sig), 2024-Jun-09, 150 KiB
Sergey Kostyaev <>
Browse ELPA's repository
CGit or Gitweb

To install this package from Emacs, use package-install or list-packages.

Full description

1. Ellama

license-GPL_3-green.svg ellama-badge.svg ellama-badge.svg ellama.svg

Ellama is a tool for interacting with large language models from Emacs. It allows you to ask questions and receive responses from the LLMs. Ellama can perform various tasks such as translation, code review, summarization, enhancing grammar/spelling or wording and more through the Emacs interface. Ellama natively supports streaming output, making it effortless to use with your preferred text editor.

The name "ellama" is derived from "Emacs Large LAnguage Model Assistant". Previous sentence was written by Ellama itself.

1.1. Installation

Just M-x package-install Enter ellama Enter. By default it uses ollama provider and zephyr model. If you ok with it, you need to install ollama and pull zephyr like this:

ollama pull zephyr

You can use ellama with other model or other llm provider. In that case you should customize ellama configuration like this:

(use-package ellama
  ;; setup key bindings
  (setopt ellama-keymap-prefix "C-c e")
  ;; language you want ellama to translate to
  (setopt ellama-language "German")
  ;; could be llm-openai for example
  (require 'llm-ollama)
  (setopt ellama-provider
	 ;; this model should be pulled to use it
	 ;; value should be the same as you print in terminal during pull
	 :chat-model "llama3:8b-instruct-q8_0"
	 :embedding-model "nomic-embed-text"
	 :default-chat-non-standard-params '(("num_ctx" . 8192))))
  ;; Predefined llm providers for interactive switching.
  ;; You shouldn't add ollama providers here - it can be selected interactively
  ;; without it. It is just example.
  (setopt ellama-providers
		  '(("zephyr" . (make-llm-ollama
				 :chat-model "zephyr:7b-beta-q6_K"
				 :embedding-model "zephyr:7b-beta-q6_K"))
		    ("mistral" . (make-llm-ollama
				  :chat-model "mistral:7b-instruct-v0.2-q6_K"
				  :embedding-model "mistral:7b-instruct-v0.2-q6_K"))
		    ("mixtral" . (make-llm-ollama
				  :chat-model "mixtral:8x7b-instruct-v0.1-q3_K_M-4k"
				  :embedding-model "mixtral:8x7b-instruct-v0.1-q3_K_M-4k"))))
  ;; Naming new sessions with llm
  (setopt ellama-naming-provider
	 :chat-model "llama3:8b-instruct-q8_0"
	 :embedding-model "nomic-embed-text"
	 :default-chat-non-standard-params '(("stop" . ("\n")))))
  (setopt ellama-naming-scheme 'ellama-generate-name-by-llm)
  ;; Translation llm provider
  (setopt ellama-translation-provider (make-llm-ollama
				     :chat-model "phi3:14b-medium-128k-instruct-q6_K"
				     :embedding-model "nomic-embed-text")))

1.2. Commands

1.2.1. ellama-chat

Ask Ellama about something by entering a prompt in an interactive buffer and continue conversation. If called with universal argument (C-u) will start new session with llm model interactive selection.

1.2.2. ellama-ask-about

Ask Ellama about a selected region or the current buffer.

1.2.3. ellama-ask-selection

Send selected region or current buffer to ellama chat.

1.2.4. ellama-ask-line

Send current line to ellama chat.

1.2.5. ellama-complete

Complete text in current buffer with ellama.

1.2.6. ellama-translate

Ask Ellama to translate a selected region or word at the point.

1.2.7. ellama-translate-buffer

Translate current buffer.

1.2.8. ellama-define-word

Find the definition of the current word using Ellama.

1.2.9. ellama-summarize

Summarize a selected region or the current buffer using Ellama.

1.2.10. ellama-summarize-killring

Summarize text from the kill ring.

1.2.11. ellama-code-review

Review code in a selected region or the current buffer using Ellama.

1.2.12. ellama-change

Change text in a selected region or the current buffer according to a provided change.

1.2.13. ellama-make-list

Create a markdown list from the active region or the current buffer using Ellama.

1.2.14. ellama-make-table

Create a markdown table from the active region or the current buffer using Ellama.

1.2.15. ellama-summarize-webpage

Summarize a webpage fetched from a URL using Ellama.

1.2.16. ellama-provider-select

Select ellama provider.

1.2.17. ellama-code-complete

Complete selected code or code in the current buffer according to a provided change using Ellama.

1.2.18. ellama-code-add

Add new code according to a description, generating it with a provided context from the selected region or the current buffer using Ellama.

1.2.19. ellama-code-edit

Change selected code or code in the current buffer according to a provided change using Ellama.

1.2.20. ellama-code-improve

Change selected code or code in the current buffer according to a provided change using Ellama.

1.2.21. ellama-improve-wording

Enhance the wording in the currently selected region or buffer using Ellama.

1.2.22. ellama-improve-grammar

Enhance the grammar and spelling in the currently selected region or buffer using Ellama.

1.2.23. ellama-improve-conciseness

Make the text of the currently selected region or buffer concise and simple using Ellama.

1.2.24. ellama-make-format

Render the currently selected text or the text in the current buffer as a specified format using Ellama.

1.2.25. ellama-load-session

Load ellama session from file.

1.2.26. ellama-session-remove

Remove ellama session.

1.2.27. ellama-session-switch

Change current active session.

1.2.28. ellama-session-rename

Rename current ellama session.

1.2.29. ellama-context-add-file

Add file to context.

1.2.30. ellama-context-add-buffer

Add buffer to context.

1.2.31. ellama-context-add-selection

Add selected region to context.

1.2.32. ellama-context-add-info-node

Add info node to context.

1.2.33. ellama-chat-translation-enable

Chat translation enable.

1.2.34. ellama-chat-translation-disable

Chat translation disable.

1.3. Keymap

Here is a table of keybindings and their associated functions in Ellama, using the ellama-keymap-prefix prefix (not set by default):

Keymap Function Description
"c c" ellama-code-complete Code complete
"c a" ellama-code-add Code add
"c e" ellama-code-edit Code edit
"c i" ellama-code-improve Code improve
"c r" ellama-code-review Code review
"s s" ellama-summarize Summarize
"s w" ellama-summarize-webpage Summarize webpage
"s c" ellama-summarize-killring Summarize killring
"s l" ellama-load-session Session Load
"s r" ellama-session-rename Session rename
"s d" ellama-session-remove Session delete
"s a" ellama-session-switch Session activate
"i w" ellama-improve-wording Improve wording
"i g" ellama-improve-grammar Improve grammar and spelling
"i c" ellama-improve-conciseness Improve conciseness
"m l" ellama-make-list Make list
"m t" ellama-make-table Make table
"m f" ellama-make-format Make format
"a a" ellama-ask-about Ask about
"a i" ellama-chat Chat (ask interactively)
"a l" ellama-ask-line Ask current line
"a s" ellama-ask-selection Ask selection
"t t" ellama-translate Text translate
"t b" ellama-translate-buffer Translate buffer
"t e" ellama-chat-translation-enable Translation enable
"t d" ellama-chat-translation-disable Translation disable
"t c" ellama-complete Text complete
"d w" ellama-define-word Define word
"x b" ellama-context-add-buffer Context add buffer
"x f" ellama-context-add-file Context add file
"x s" ellama-context-add-selection Context add selection
"x i" ellama-context-add-info-node Context add info node
"p s" ellama-provider-select Provider select

1.4. Configuration

The following variables can be customized for the Ellama client:

  • ellama-enable-keymap: Enable the Ellama keymap.
  • ellama-keymap-prefix: The keymap prefix for Ellama.
  • ellama-user-nick: The user nick in logs.
  • ellama-assistant-nick: The assistant nick in logs.
  • ellama-language: The language for Ollama translation. Default

language is english.

  • ellama-provider: llm provider for ellama. Default provider is

ollama with zephyr model. There are many supported providers: ollama, open ai, vertex, GPT4All. For more information see llm documentation.

  • ellama-providers: association list of model llm providers with name as key.
  • ellama-spinner-type: Spinner type for ellama. Default type is


  • ellama-ollama-binary: Path to ollama binary.
  • ellama-auto-scroll: If enabled ellama buffer will scroll automatically during generation. Disabled by default.
  • ellama-fill-paragraphs: Option to customize ellama paragraphs filling behaviour.
  • ellama-name-prompt-words-count: Count of words in prompt to generate name.
  • Prompt templates for every command.
  • ellama-chat-done-callback: Callback that will be called on ellama

chat response generation done. It should be a function with single argument generated text string.

  • ellama-nick-prefix-depth: User and assistant nick prefix depth. Default value is 2.
  • ellama-sessions-directory: Directory for saved ellama sessions.
  • ellama-major-mode: Major mode for ellama commands. Org mode by default.
  • ellama-long-lines-length: Long lines length for fill paragraph call. Too low value can break generated code by splitting long comment lines. Default value 100.
  • ellama-session-auto-save: Automatically save ellama sessions if set. Enabled by default.
  • ellama-naming-scheme: How to name new sessions.
  • ellama-naming-provider: LLM provider for generating session names by LLM. If not set ellama-provider will be used.
  • ellama-chat-translation-enabled: Enable chat translations if set.
  • ellama-translation-provider: LLM translation provider. ellama-provider will be used if not set.
  • ellama-show-quotes: Show quotes content in chat buffer. Disabled by default.

1.5. Acknowledgments

Thanks Jeffrey Morgan for excellent project ollama. This project cannot exist without it.

Thanks zweifisch - I got some ideas from ollama.el what ollama client in Emacs can do.

Thanks Dr. David A. Kunz - I got more ideas from gen.nvim.

Thanks Andrew Hyatt for llm library. Without it only ollama would be supported.

2. Contributions

To contribute, submit a pull request or report a bug. This library is part of GNU ELPA; major contributions must be from someone with FSF papers. Alternatively, you can write a module and share it on a different archive like MELPA.

Old versions

ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB
ellama- KiB


1. Version 0.9.10

  • Add file quote context elements.

2. Version 0.9.9

  • Add info node quote context elements.

3. Version 0.9.8

  • Copy context from previous session on creating new session. This is useful when you create new session by calling ellama-ask-about with prefix argument.

4. Version 0.9.7

  • Add webpage quote context elements.

5. Version 0.9.6

  • Improve code blocks translation from markdown to org.

6. Version 0.9.5

  • Establish a fresh chat session whenever the ellama-chat function is invoked with a provider different from the one currently in use.

7. Version 0.9.4

  • Improve code blocks translation from markdown to org.

8. Version 0.9.3

  • Support summarize shr url at point (eww and elfeed).
  • Add ellama-chain function for chaining multiple calls to LLMs.

9. Version 0.9.2

  • Allow summarizing urls withoud doctype tag.
  • Summarize url at point.

10. Version 0.9.1

  • Add summarize killring command.

11. Version 0.9.0

  • Improve context management. Make it extendable.

12. Version 0.8.14

  • Don't insert blank line on code change actions.

13. Version 0.8.13

  • Simplify switching between org and markdown.

14. Version 0.8.12

  • Construct a local list instead of pushin to global one.

15. Version 0.8.11

  • Remove dash dependency.
  • Remove function ellama--fill-string.
  • Rewrite function ellama--fill-long-lines to use fill-region.
  • Use thread-last instead of ->> from dash.

16. Version 0.8.10

  • Fix context for chat translation.
  • Refactor translations.
  • Add command for current buffer translation.

17. Version 0.8.9

  • Add chat translation.

18. Version 0.8.8

  • Fix some bad markdown to org translations.

19. Version 0.8.7

  • Fix interactive local model selection for emacs 28.

20. Version 0.8.6

  • Add provider to ellama-chat arguments.

21. Version 0.8.5

  • Improve working with context:
    • Fix some org-mode links.
    • Add command for adding info nodes into context.
    • Fix keybindings documentation.

22. Version 0.8.4

  • Fix keybindings. Keymap prefix now not set by default to prevent usage of reserved for end user customisation keys.

23. Version 0.8.3

  • Fix non-chat commands.

24. Version 0.8.2

  • Fix chat on model switching.

25. Version 0.8.1

  • Add naming scheme user option.

26. Version 0.8.0

  • Add context management.

27. Version 0.7.7

  • Apply markdown-to-org filter consistently.

28. Version 0.7.6

  • Eliminate eval call.

29. Version 0.7.5

  • Make ellama-request-mode for cancel active requests.

30. Version 0.7.4

  • Avoid advising global functions. Use minor modes instead.

31. Version 0.7.3

  • Add sessions auto save. If not set will not use named files for new sessions. Enabled by default.
  • ellama-major-mode used instead of ellama-instant-mode and used not only for ellama instant buffers, but also for ellama chat buffers.

32. Version 0.7.2

  • Replace / with _ in new note filenames to prevent errors.

33. Version 0.7.1

  • Improve markdown to org conversion.
  • Move readme from markdown to org.

34. Version 0.7.0

  • Switch from markdown to org-mode.
  • Fix bug in session management on buffer kill.
  • Decrease pressure to garbage collector during text generation.

35. Version 0.6.0

  • Implement session management.

36. Version 0.5.8

  • Fix typo in predefined prompts.

37. Version 0.5.7

  • Add ellama-nick-prefix custom variable.

38. Version 0.5.6

  • Add llm name to generated ellama name.

39. Version 0.5.5

  • Add ellama-chat-done-callback.

40. Version 0.5.4

  • Support interactive switch models on remote host.

41. Version 0.5.3

  • Support cancellation.

42. Version 0.5.2

  • Make default prompt templates customizable.

43. Version 0.5.1

  • Use more meaningful buffer names.

44. Version 0.5.0

  • Eliminate aliases.

45. Version 0.4.14

  • Extract ellama-chat-done to separate function.

46. Version 0.4.13

  • Use custom-set-default in set function for custom variables.

47. Version 0.4.12

  • Add option to customize paragraphs filling behaviour.

48. Version 0.4.11

  • Fix compilation

49. Version 0.4.10

  • Add customization group.
  • Call ellama-setup-keymap on prefix change.

50. Version 0.4.9

  • Call fill-region only for non-programming modes.

51. Version 0.4.8

… …