diff options
Diffstat (limited to 'epistemia/services/machine-learning.scm')
| -rw-r--r-- | epistemia/services/machine-learning.scm | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/epistemia/services/machine-learning.scm b/epistemia/services/machine-learning.scm index 3d94908..094049c 100644 --- a/epistemia/services/machine-learning.scm +++ b/epistemia/services/machine-learning.scm | |||
| @@ -9,59 +9,53 @@ | |||
| 9 | llama-swap-configuration? | 9 | llama-swap-configuration? |
| 10 | llama-swap-service-type)) | 10 | llama-swap-service-type)) |
| 11 | 11 | ||
| 12 | (define-record-type* <llama-swap-configuration> | 12 | (define-record-type* <llm-router-configuration> |
| 13 | llama-swap-configuration make-llama-swap-configuration | 13 | llm-router-configuration make-llm-router-configuration |
| 14 | llama-swap-configuration? | 14 | llm-router-configuration? |
| 15 | (package llama-swap-configuration-package | 15 | (package llm-router-configuration-package |
| 16 | (default llama-swap)) | 16 | (default llm-router)) |
| 17 | (llama-cpp llama-swap-configuration-llama-cpp | 17 | (llama-cpp llm-router-configuration-llama-cpp |
| 18 | (default llama-cpp)) | 18 | (default llama-cpp)) |
| 19 | (config llama-swap-configuration-config) | 19 | (config llm-router-configuration-config) |
| 20 | (listen llama-swap-configuration-listen | 20 | (listen llm-router-configuration-listen |
| 21 | (default ":8080")) | 21 | (default ":8080")) |
| 22 | (watch-config? llama-swap-configuration-watch-config? | 22 | (watch-config? llm-router-configuration-watch-config? |
| 23 | (default #f))) | 23 | (default #f))) |
| 24 | 24 | ||
| 25 | (define llama-swap-account-service | 25 | (define llm-router-account-service |
| 26 | (list (user-account | 26 | (list (user-account |
| 27 | (name "llama-swap") | 27 | (name "llm-router") |
| 28 | (group "nogroup") | 28 | (group "nogroup") |
| 29 | (system? #t) | 29 | (system? #t) |
| 30 | (comment "llama-swap daemon user") | 30 | (comment "llm-router daemon user") |
| 31 | (home-directory "/var/empty") | 31 | (home-directory "/var/empty") |
| 32 | (shell (file-append shadow "/sbin/nologin"))))) | 32 | (shell (file-append shadow "/sbin/nologin"))))) |
| 33 | 33 | ||
| 34 | (define (llama-swap-shepherd-service config) | 34 | (define (llm-router-shepherd-service config) |
| 35 | (let ((pkg (llama-swap-configuration-package config)) | 35 | (let ((pkg (llm-router-configuration-package config)) |
| 36 | (lcpp (llama-swap-configuration-llama-cpp config)) | 36 | (lcpp (llm-router-configuration-llama-cpp config)) |
| 37 | (cfg (llama-swap-configuration-config config)) | 37 | (cfg (llm-router-configuration-config config))) |
| 38 | (listen (llama-swap-configuration-listen config)) | ||
| 39 | (watch? (llama-swap-configuration-watch-config? config))) | ||
| 40 | (list | 38 | (list |
| 41 | (shepherd-service | 39 | (shepherd-service |
| 42 | (documentation "llama-swap OpenAI-compatible model proxy") | 40 | (documentation "llm-router OpenAI-compatible model proxy") |
| 43 | (provision '(llama-swap)) | 41 | (provision '(llm-router)) |
| 44 | (requirement '(networking)) | 42 | (requirement '(networking)) |
| 45 | (start #~(make-forkexec-constructor | 43 | (start #~(make-forkexec-constructor |
| 46 | (append | 44 | (append |
| 47 | (list #$(file-append pkg "/bin/llama-swap") | 45 | (list #$(file-append pkg "/bin/llm-router"))) |
| 48 | "-config" #$cfg | 46 | #:user "llm-router" |
| 49 | "-listen" #$listen) | ||
| 50 | (if #$watch? '("-watch-config") '())) | ||
| 51 | #:user "llama-swap" | ||
| 52 | #:environment-variables | 47 | #:environment-variables |
| 53 | (cons (string-append "PATH=" #$(file-append lcpp "/bin")) | 48 | (cons (string-append "PATH=" #$(file-append lcpp "/bin")) |
| 54 | (default-environment-variables)))) | 49 | (default-environment-variables)))) |
| 55 | (stop #~(make-kill-destructor)))))) | 50 | (stop #~(make-kill-destructor)))))) |
| 56 | 51 | ||
| 57 | (define llama-swap-service-type | 52 | (define llm-router-service-type |
| 58 | (service-type (name 'llama-swap) | 53 | (service-type (name 'llm-router) |
| 59 | (extensions | 54 | (extensions |
| 60 | (list (service-extension account-service-type | 55 | (list (service-extension account-service-type |
| 61 | (const llama-swap-account-service)) | 56 | (const llm-router-account-service)) |
| 62 | (service-extension shepherd-root-service-type | 57 | (service-extension shepherd-root-service-type |
| 63 | llama-swap-shepherd-service))) | 58 | llm-router-shepherd-service))) |
| 64 | (description | 59 | (description |
| 65 | "llama-swap is an @code{OpenAI} API compatible server that gives you complete | 60 | "llm-router is a proxy to OpenAI-compatible and SDAPI-compatible API |
| 66 | control over how you use your hardware. It automatically swaps to the | 61 | servers."))) |
| 67 | configuration of your choice for serving a model."))) | ||
