Commit graph naco-api/internal/ollama
Author SHA1 Message Date
67d35a0a2f
fix: harden Ollama client embeddings, truncation, and retries
- embed posts in a bounded worker pool while preserving index order,
  with per-post error context and transient (429/5xx) retry backoff
- SummarizeStyle errors when the stream ends before a done chunk or the
  model truncates at its context limit (done_reason length) instead of
  returning a partial summary for a payable tool
- New() drops the unused ctx param and names its model params; callers
  in main.go updated
2026-09-09 23:18:01 +00:00
1640fae6be
fix: surface relay-connect and stream-cancel errors
- nostr GetPost: track whether any relay was reached so an unreachable
  relay set surfaces 'could not connect to any relay' (consistent with
  GetLatestNPosts/GetPostsInTimeframe) instead of a misleading
  'post not found'.
- ollama SummarizeStyle: surface ctx cancellation after Generate when
  the Ollama stream reader closes cleanly on a canceled context,
  instead of returning a truncated summary.
2026-09-09 14:42:10 +00:00
5cd1d128d6
test: expand Ollama client tests and store integration coverage 2026-09-08 01:25:44 +00:00
6477d5845f test: remove tautological stdlib-roundabout tests
Aggressive deletion of tests that only replay stdlib or copy impl:
- config/config_test.go: getEnvBool/splitComma/Load defaults (strings.* wrappers)
- utils/styleProfiles_test.go: ParseEmbedding type-switch
- store/migrate_test.go: extractUpSQL marker parsing
- clustering/kmeans_test.go: IdenticalVectors/SingleItem/DifferentSeeds (trivial)
- ollama/client_test.go: PromptStructure/UsesProvidedModels (setter replay)
2026-09-03 17:00:24 +00:00
877f839926 test: add clustering KMeans tests and ollama client tests
- clustering/kmeans_test.go: TestKMeans (basic, empty, k>n, identical, single, deterministic, high-dim), TestCosineSimilarity, TestNormalize, TestInitializeKMeansPlusPlus
- ollama/client_test.go: TestEmbedTexts, TestSummarizeStyle (streaming, errors, empty input), TestNew_UsesProvidedModels
- ollama/client.go: early return for empty input in EmbedTexts/SummarizeStyle
2026-09-02 00:30:19 +02:00
ad67171f37 config: move Ollama model defaults to config package
- config.go: set EMBEDDING_MODEL=qwen3-embedding:0.6b, STYLE_MODEL=qwen3:4b as defaults
- ollama/client.go: remove hardcoded fallback logic, use passed values directly
- Single source of truth for model defaults in config package
2026-09-02 00:09:06 +02:00
d3845671b4 ollama: fix EmbedTexts signature, add model config, use clustering package
- ollama/client.go: EmbedTexts accepts []clustering.Item, returns [][]float64
- backends.go: ollamaBackend interface uses clustering.Item
- utils/styleProfiles.go: remove duplicate KMeans, normalize, cosineSimilarity
- clustering/: new package with Item, Result types and KMeans
- config.go: add EmbeddingModel, StyleModel env vars
- main.go: pass model config to ollama.New()
- go.mod: add github.com/ethereum/go-ethereum for test client
2026-09-01 23:40:21 +02:00
b87910d1c4 Major changes 2025-12-02 19:33:03 +00:00