about summary refs log tree commit diff
path: root/pkgs/by-name/lo/local-ai/module.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/lo/local-ai/module.nix')
-rw-r--r--pkgs/by-name/lo/local-ai/module.nix28
1 files changed, 18 insertions, 10 deletions
diff --git a/pkgs/by-name/lo/local-ai/module.nix b/pkgs/by-name/lo/local-ai/module.nix
index d7b70048121f3..e26a3637820f8 100644
--- a/pkgs/by-name/lo/local-ai/module.nix
+++ b/pkgs/by-name/lo/local-ai/module.nix
@@ -5,7 +5,7 @@ let
 in
 {
   options.services.local-ai = {
-    enable = lib.mkEnableOption "Enable service";
+    enable = lib.mkEnableOption "local-ai";
 
     package = lib.mkPackageOption pkgs "local-ai" { };
 
@@ -28,25 +28,33 @@ in
       type = types.either types.package types.str;
       default = "models";
     };
+
+    parallelRequests = mkOption {
+      type = types.int;
+      default = 1;
+    };
+
+    logLevel = mkOption {
+      type = types.enum [ "error" "warn" "info" "debug" "trace" ];
+      default = "warn";
+    };
   };
 
   config = lib.mkIf cfg.enable {
     systemd.services.local-ai = {
       wantedBy = [ "multi-user.target" ];
+      environment.LLAMACPP_PARALLEL = toString cfg.parallelRequests;
       serviceConfig = {
         DynamicUser = true;
         ExecStart = lib.escapeShellArgs ([
           "${cfg.package}/bin/local-ai"
-          "--debug"
-          "--address"
-          ":${toString cfg.port}"
-          "--threads"
-          (toString cfg.threads)
-          "--localai-config-dir"
-          "."
-          "--models-path"
-          (toString cfg.models)
+          "--address=:${toString cfg.port}"
+          "--threads=${toString cfg.threads}"
+          "--localai-config-dir=."
+          "--models-path=${cfg.models}"
+          "--log-level=${cfg.logLevel}"
         ]
+        ++ lib.optional (cfg.parallelRequests > 1) "--parallel-requests"
         ++ cfg.extraArgs);
         RuntimeDirectory = "local-ai";
         WorkingDirectory = "%t/local-ai";