-
Notifications
You must be signed in to change notification settings - Fork 0
feat: re-add local LLM foundations with yzma-ready config #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: revert/local-llm-llamago
Are you sure you want to change the base?
Conversation
Re-introduce pure Go foundations for local LLM support, now designed for hybridgroup/yzma (purego) instead of llama-go (CGo): - EmbeddingComparer and Closer optional interfaces in client.go - CosineSimilarity + normalize utility functions with tests - LocalClient stub (always unavailable, yzma backend in next PR) - LocalConfig with new LibPath field for yzma shared library dir - Config: LocalLibPath + FLOOP_LOCAL_LIB_PATH env override - Config: LocalModelPath, LocalEmbeddingModelPath, LocalGPULayers, LocalContextSize fields and env overrides restored - "local" provider in config validation and CLI factory - Embedding comparison path in store_dedup.go computeSimilarity - "embedding" in SimilarityMethod docs No external dependencies — builds and tests pass with standard Go. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile OverviewGreptile SummaryReintroduces local LLM foundations by adding a new Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| cmd/floop/main.go | Adds "local" provider case that constructs a LocalClient using new local config fields. |
| internal/config/config.go | Adds local LLM config fields + env overrides and allows "local" as valid provider. |
| internal/config/config_test.go | Adds tests for parsing and env overrides of new local LLM config fields. |
| internal/dedup/dedup.go | Updates SimilarityMethod docs to include the new "embedding" method. |
| internal/dedup/store_dedup.go | Restores embedding-based similarity path via optional EmbeddingComparer, but current gating on Client.Available() makes it unreachable for stub LocalClient. |
| internal/llm/client.go | Introduces optional EmbeddingComparer and Closer interfaces for capability-based feature detection. |
| internal/llm/local.go | Adds LocalClient stub implementing Client/EmbeddingComparer with config plumbed through; methods currently return 'not wired' errors except MergeBehaviors via fallback. |
| internal/llm/local_test.go | Adds unit tests ensuring LocalClient stub behavior and interface compliance. |
| internal/llm/similarity.go | Adds cosine similarity and in-place vector normalization utilities. |
| internal/llm/similarity_test.go | Adds tests covering cosine similarity edge cases and normalization behavior. |
Sequence Diagram
sequenceDiagram
participant CLI as cmd/floop
participant Config as internal/config
participant Factory as llm factory
participant Local as internal/llm/local
participant Dedup as internal/dedup
participant Store as store_dedup
CLI->>Config: Load config (env overrides)
CLI->>Factory: Select client type ("local")
Factory->>Local: NewLocalClient(LocalConfig{LibPath,...})
Local-->>Factory: LocalClient (stub unavailable)
CLI->>Dedup: Run dedup
Dedup->>Store: Compare embeddings
Store->>Local: EmbeddingComparer? / Embedder?
Local-->>Store: Error/unavailable
Store-->>Dedup: Falls back / handles unavailable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, 1 comment
| ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) | ||
| defer cancel() | ||
|
|
||
| // Try LLM comparison | ||
| // Prefer embedding-based comparison if supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedding path is unreachable
computeSimilarity only attempts EmbeddingComparer when d.llmClient.Available() is true. In this PR, LocalClient.Available() is a stub that always returns false, so the new embedding-based comparison will never run for the new local provider (and SimilarityMethod = "embedding" will never be produced). If the intent is to allow embedding comparison even when the full LLM provider is “unavailable” (e.g., generation unavailable but embeddings work), the embedding branch needs to run based on EmbeddingComparer support rather than Client.Available().
Summary
LocalLibPathconfig field +FLOOP_LOCAL_LIB_PATHenv override for yzma shared library directoryChanges
client.go: EmbeddingComparer and Closer optional interfacessimilarity.go: CosineSimilarity + normalize functions with testslocal.go: LocalClient stub with LocalConfig (includes LibPath)local_test.go: Unit tests for stub behavior, interface compliance, config fieldsconfig.go: LocalLibPath, LocalModelPath, LocalEmbeddingModelPath, LocalGPULayers, LocalContextSize + env overridesconfig_test.go: Tests for new config fieldsmain.go:case "local":factory passes LibPathstore_dedup.go: Embedding comparison path restoreddedup.go: "embedding" in SimilarityMethod docsStacked on: #57 (revert)
Test plan
go build ./cmd/floop— builds cleanlygo vet ./...— no issuesgo test ./...— all 25 packages pass🤖 Generated with Claude Code