-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elaiza-backends.el
48 lines (41 loc) · 1.49 KB
/
elaiza-backends.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;; elaiza-backends.el --- Available LLM backend implementations -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Alessandro Wollek
;;
;; Author: Alessandro Wollek <[email protected]>
;; Homepage: https://github.com/SFTtech/emacs-elaiza
;; SPDX-License-Identifier: GPL-3.0-only
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; All available LLM backend implementations.
;;
;;; Code:
(require 'cl-lib)
(cl-defstruct elaiza-backend
"Struct for backend-specific dispatching."
name
(pre-request-function nil :type 'function))
(defvar elaiza-backends-integrations-alist nil
"LLM backends that are incorporated into ELAIZA.")
(defvar elaiza--backend nil
"Default elaiza backend for current buffer.")
(defun elaiza-backends--add-integration (backend)
"Add an LLM BACKEND integration to ELAIZA."
(unless (assoc (elaiza-backend-name backend) elaiza-backends-integrations-alist)
(push (cons (elaiza-backend-name backend) backend)
elaiza-backends-integrations-alist)))
(defcustom elaiza-available-backends nil
"Available ELAIZA backends.
See `elaiza-backends-integrations-alist' for a list of supported backends."
:group 'elazia
:type 'list)
(defun elaiza-add-available-backend (backend)
"Add BACKEND to available `elaiza-available-backends'."
(unless (assoc (elaiza-backend-name backend) elaiza-available-backends)
(push (cons (elaiza-backend-name backend) backend)
elaiza-available-backends)))
(provide 'elaiza-backends)
;;; elaiza-backends.el ends here