Compare commits

...

2 Commits

Author SHA1 Message Date
72204b9817 feat: claude api support 2025-04-05 11:23:00 -04:00
303cec1b3c wip: ollama support? 2025-04-04 13:26:45 -04:00
5 changed files with 70 additions and 6 deletions

View File

@ -44,6 +44,10 @@ in
# }; # };
#}; #};
services.ollama = {
enable = true;
user="zaphar";
};
services.my-lorri.enable = true; services.my-lorri.enable = true;
services.durnitisp.enable = true; services.durnitisp.enable = true;
services.node-exporter.enable = true; services.node-exporter.enable = true;

View File

@ -369,6 +369,8 @@ EOF";
victoriametrics victoriametrics
# TODO add sonic-pi here if it supports the arch # TODO add sonic-pi here if it supports the arch
unstablePkgs.dbeaver-bin unstablePkgs.dbeaver-bin
postgresql
unstablePkgs.ollama
]) ])
#++ (with pkgs.ocamlPackages; [ #++ (with pkgs.ocamlPackages; [
# dune_3 # dune_3
@ -397,6 +399,7 @@ EOF";
./modules/victoria-logs.nix ./modules/victoria-logs.nix
./modules/vector.nix ./modules/vector.nix
./modules/lorri.nix ./modules/lorri.nix
./modules/ollama.nix
./darwin-configuration.nix ./darwin-configuration.nix
]; ];
}; };

View File

@ -672,11 +672,11 @@ require('copilot').setup();
require('avante').setup ({ require('avante').setup ({
provider = "copilot", provider = "copilot",
openai = { claude = {
model = "Claude Sonnet 3.7", -- your desired model (or use gpt-4o, etc.) endpoint = "https://api.anthropic.com",
timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models model = "claude-3-7-sonnet-20250219",
timeout = 30000, -- Timeout in milliseconds
temperature = 0, temperature = 0,
max_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) max_tokens = 20480,
--reasoning_effort = "medium", -- low|medium|high, only used for reasoning models };
},
}) })

View File

@ -0,0 +1,56 @@
{pkgs, lib, config, ...}:
with lib;
let
mkLauncher = import ../../packages/darwin-launcher.nix { inherit pkgs; };
ollamaLauncher = mkLauncher ''
exec ${pkgs.clio}/bin/clio \
--out-path=${config.services.ollama.stdoutPath} \
--err-path=${config.services.ollama.stdoutPath} \
--pid-file=${config.services.ollama.pidPath} \
--paranoid \
-- \
${pkgs.ollama}/bin/ollama \
serve
'';
in
{
options.services.ollama = {
enable = mkEnableOption "Enable the ollama agent";
stdoutPath = mkOption {
default = "/Users/${config.services.ollama.user}/config/ollama/out.log";
};
stderrPath = mkOption {
default = "/Users/${config.services.ollama.user}/config/ollama/err.log";
};
pidPath = mkOption {
default = "/Users/${config.services.ollama.user}/config/ollama/ollama.pid";
};
user = mkOption {
default="zaphar";
};
};
config = {
launchd.user.agents.ollama = mkIf config.services.ollama.enable {
serviceConfig = {
ProgramArguments = [
"${ollamaLauncher}"
];
EnvironmentVariables = {
"OLLAMA_HOST" = "127.0.0.1:11434";
"OLLAMA_MODELS" = "/Users/${config.services.ollama.user}/config/ollama/";
};
RunAtLoad = true;
};
};
environment.etc."newsyslog.d/org.nixos.ollama.conf" = mkIf config.services.ollama.enable {
text = ''
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${config.services.ollama.stdoutPath} zaphar:staff 644 10 1000 * BJ ${config.services.ollama.pidPath} 1
${config.services.ollama.stderrPath} zaphar:staff 644 10 1000 * BJ ${config.services.ollama.pidPath} 1
'';
};
};
}

View File

@ -44,4 +44,5 @@ function disk_usage() {
eval "$(direnv hook zsh)" eval "$(direnv hook zsh)"
export ANTHROPIC_API_KEY="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"
export OPENAI_API_KEY="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" export OPENAI_API_KEY="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"