Skip to content

Commit

Permalink
feat: add me-ai module
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jan 25, 2024
1 parent d0aec15 commit 6e293e3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions modules/me-ai.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
;; me-ai.el --- AI assistants -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2024 Abdelhak Bougouffa

;; Author: Abdelhak Bougouffa (rot13 "nobhtbhssn@srqbencebwrpg.bet")

;;; Commentary:

;;; Code:

(use-package llm-ollama
:straight llm
:autoload make-llm-ollama)

(use-package ellama
:straight t
:init
(defvar +ellama-process-name "ellama-server")
(defvar +ellama-server-buffer-name " *ellama-server*")
(defun +ellama-serve ()
"Start Ellama server."
(interactive)
(if (executable-find "ollama")
(if (get-process +ellama-process-name)
(message "The Ollama server is already running, call `+ellama-kill-server' to stop it.")
(if (make-process :name +ellama-process-name :buffer +ellama-server-buffer-name :command '("ollama" "serve"))
(message "Successfully started Ollama server.")
(user-error "Cannot start the Ollama server")))
(user-error "Cannot find the \"ollama\" executable")))
(defun +ellama-kill-server ()
"Kill Ellama server."
(interactive)
(let ((ollama (get-process +ellama-process-name)))
(if ollama
(if (kill-process ollama)
(message "Killed Ollama server.")
(user-error "Cannot kill the Ollama server"))
(message "No running Ollama server."))))
:custom
(ellama-provider (make-llm-ollama :chat-model "llama2:13b" :embedding-model "llama2:13b")))


(provide 'me-ai)

;;; me-ai.el ends here
1 change: 1 addition & 0 deletions skel/modules.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
;;; List of enabled modules
(setq minemacs-modules
'(me-ui ; User interface (svg-lib, focus, mixed-pitch, ...)
me-ai ; AI assistant using ollama (ellama, llm, ...)
me-editor ; Editing (tempel, tempel-collection, rainbow-delimiters, expreg, drag-stuff, ...)
me-daemon ; Emacs daemon tweaks
me-undo ; Better undoing (undo-fu, undo-fu-session, vundo, ...)
Expand Down

0 comments on commit 6e293e3

Please sign in to comment.