summaryrefslogtreecommitdiff
path: root/internal/cli/llm.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-05-01 22:14:37 -1000
committerGitHub <noreply@github.com>2026-05-01 22:14:37 -1000
commit99115d8158137083239c45e5a860b718ff4cefa1 (patch)
tree1bf3bd0505eea79375c67af83c7c5fe8c0f274ff /internal/cli/llm.go
parentc2aa026f6ce1c9e216b99d74f294fc133d5fcddd (diff)
parent50f8fe8c1ff8b82e0bd399e5776e58bda3e57d1c (diff)
Merge pull request #1 from thepeterstone/claude/local-oss-model-agents-MEBqj
Local OSS models as a third runner (epic)
Diffstat (limited to 'internal/cli/llm.go')
-rw-r--r--internal/cli/llm.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/cli/llm.go b/internal/cli/llm.go
new file mode 100644
index 0000000..04fe902
--- /dev/null
+++ b/internal/cli/llm.go
@@ -0,0 +1,31 @@
+package cli
+
+import (
+ "log/slog"
+ "net/http"
+ "time"
+
+ "github.com/thepeterstone/claudomator/internal/config"
+ "github.com/thepeterstone/claudomator/internal/llm"
+)
+
+// buildLocalLLMClient returns an *llm.Client when a local model endpoint is
+// configured. Returns nil when LocalModel.Endpoint is empty so callers can
+// gate on `if c != nil` to skip registering LocalRunner / using the LLM
+// classifier path.
+func buildLocalLLMClient(cfg config.LocalModel, logger *slog.Logger) *llm.Client {
+ if cfg.Endpoint == "" {
+ return nil
+ }
+ timeout := 60 * time.Second
+ if cfg.TimeoutSeconds > 0 {
+ timeout = time.Duration(cfg.TimeoutSeconds) * time.Second
+ }
+ return &llm.Client{
+ Endpoint: cfg.Endpoint,
+ Model: cfg.Model,
+ APIKey: cfg.APIKey,
+ HTTPClient: &http.Client{Timeout: timeout},
+ Logger: logger,
+ }
+}