mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-30 18:09:05 -04:00
* feat: add Valkey Search vector store backend Add a new built-in Go gRPC store backend 'valkey-store' that implements the four Stores RPCs (Set/Get/Delete/Find) against the Valkey Search module (FT.*) using the pure-Go github.com/valkey-io/valkey-go client. It is selected via the existing per-request 'backend' field on /stores, so there is no proto or HTTP API change, and it mirrors the in-memory local-store while adding persistence across restarts and opt-in HNSW. Each vector is a Valkey HASH keyed by hex(little-endian float32); the index is created lazily on first Set (FLAT+COSINE by default), cosine similarity is derived as 1-distance, and namespaces get a collision-resistant token. Includes unit tests (valkey-go mock) and env-gated integration tests against valkey/valkey-bundle, plus build/matrix/gallery wiring and docs. Assisted-by: Kiro:claude-opus-4.8 golangci-lint Signed-off-by: Daria Korenieva <daric2612@gmail.com> * Address review feedback: recover persisted index dimension, harden Find - Load now recovers the persisted vector DIM from FT.INFO (not just index existence), so a post-restart Set/Find validates against the real DIM instead of silently re-learning a wrong one and dropping mismatched vectors from the index. This also restores Find's dimension check after a restart. - StoresFind treats a dropped/missing index as an empty store (empty result, no error) and clears the stale indexCreated flag, matching local-store's empty-store behaviour. - StoresSet reuses checkDims for its per-key length check so the four RPCs share one dimension-guard implementation. - Add unit tests for FT.INFO dimension recovery, loadIndexState, and the dropped-index Find path. Assisted-by: Kiro:claude-opus-4.8 Signed-off-by: Daria Korenieva <daric2612@gmail.com> * Address review feedback: TLS ServerName/CA, Find nil-check, config fail-fast Addresses external review comments on the valkey-store backend: - StoresFind now rejects a nil/empty query Key before dereferencing it, so a malformed gRPC request can no longer panic the backend. - TLS: derive ServerName (SNI) from the VALKEY_ADDR host so certificate verification works for IP-addressed endpoints, and add VALKEY_TLS_CA_CERT (custom CA bundle) and VALKEY_TLS_SKIP_VERIFY (testing-only) knobs. - Config integer parsing now fails fast on a malformed value (e.g. VALKEY_HNSW_M=1x6) instead of silently defaulting, matching the fail-fast behaviour of the index-algo/distance-metric validation. - Add VALKEY_DB (SELECT n) support for logical-DB isolation. - Cap the human-readable part of a namespace token at 64 chars so a very long model name cannot produce an unbounded key prefix / index name (the appended short hash keeps distinct namespaces collision-free). - Document the KNN-query injection-safety invariant (fields are constants) and why StoresGet uses a single aggregate DoMulti deadline for reads. - Unit tests for the Find nil/empty-key guard, fail-fast HNSW parsing, and VALKEY_DB parsing/validation; docs + .env updated for the new vars. Assisted-by: Kiro:claude-opus-4.8 golangci-lint Signed-off-by: Daria Korenieva <daric2612@gmail.com> * Address review feedback: configure valkey-store via model config richiejp asked that the valkey-store backend take its configuration from a model config rather than process-wide VALKEY_* environment variables, so multiple stores can each have their own Valkey config within one LocalAI process. This removes every env access from the backend and routes config through the model-config seam every other backend uses. - config.go: loadConfig(opts *pb.ModelOptions) now parses the model config `options:` list (key:value strings, split on the first ':') instead of os.Getenv. Option keys mirror the old VALKEY_* names without the prefix (addr, index_algo, distance_metric, ...). Defaults, fail-fast validation and the mandatory client name are unchanged. - store.go: Load threads opts into loadConfig; TLS comments/errors renamed off the VALKEY_* names. - core/backend/stores.go: StoreBackend and NewVectorStore take a *config.ModelConfigLoader, resolve the per-store ModelConfig by store name, and pass its Options (and Backend when unset) to the backend via WithLoadGRPCLoadModelOpts. No config -> default backend + built-in defaults, preserving the zero-config experience. - Endpoints/routes/application: thread the config loader to StoreBackend. - Unit + integration tests: configure via options; the integration test passes addr through the model-config path (VALKEY_ADDR is now only the test harness locating the server). - docs + .env: document the model-config options, drop the env var table. Assisted-by: Kiro:claude-opus-4.8 Signed-off-by: Daria Korenieva <daric2612@gmail.com> * Remove valkey-store informational comment from .env The backend is configured via model config, not env vars — the comment was unnecessary noise in .env. The configuration is already documented in docs/content/features/stores.md. Signed-off-by: Daria Korenieva <daric2612@gmail.com> * feat(valkey-store): gate Load on NamespacePrefix to refuse autoload probing Mirror local-store's pattern: reject model names without store.NamespacePrefix so the model loader's greedy autoload probe cannot bind an arbitrary model name to the vector store backend (the #9287 failure mode). Also adds unit tests for the gate covering: prefixed namespace, prefix alone, unprefixed model name, empty model, and nil opts. Signed-off-by: Daria Korenieva <daric2612@gmail.com> * feat(valkey-store): add username_env/password_env credential indirection Add support for resolving Valkey credentials from environment variables named in the model config, mirroring cloud-proxy's api_key_env pattern. This keeps secrets out of model YAML files and lets distinct store configs each reference their own credentials. Options: username_env / password_env name the env var holding the value. The direct username / password options still work and take precedence when both are set (backward compatible). Includes 5 unit tests and updated stores.md documentation. Signed-off-by: Daria Korenieva <daric2612@gmail.com> * fix: correct rebase artifacts in backend-matrix.yml and Makefile Fix two issues introduced by the conflict-resolution script during the rebase onto master: 1. .github/backend-matrix.yml: valkey-store entries were merged INTO the cloud-proxy entries (duplicate keys in same YAML map items) instead of being separate list items. This broke cloud-proxy Linux builds and the cloud-proxy darwin entry lost its build-type/lang. Fixed by making them standalone entries and restoring cloud-proxy exactly as on master. 2. Makefile: duplicated .NOTPARALLEL and docker-build-backends lines. Collapsed to single lines that are master's current content plus the valkey-store additions. Also adds the three optional pickups from #10801: - /valkey-store in .gitignore (the built binary) - valkey-store row in docs/content/reference/compatibility-table.md - valkey-store line in backend/README.md Signed-off-by: Daria Korenieva <daric2612@gmail.com> --------- Signed-off-by: Daria Korenieva <daric2612@gmail.com> Co-authored-by: Daria Korenieva <daric2612@gmail.com>
122 lines
2.9 KiB
Plaintext
122 lines
2.9 KiB
Plaintext
# go-llama build artifacts
|
|
/sources/
|
|
__pycache__/
|
|
*.a
|
|
*.o
|
|
get-sources
|
|
prepare-sources
|
|
/backend/cpp/llama-cpp/grpc-server
|
|
/backend/cpp/llama-cpp/llama.cpp
|
|
/backend/cpp/llama-*
|
|
!backend/cpp/llama-cpp
|
|
/backends
|
|
/backend-images
|
|
/result.yaml
|
|
protoc
|
|
|
|
*.log
|
|
|
|
go-ggml-transformers
|
|
go-gpt2
|
|
whisper.cpp
|
|
/bloomz
|
|
go-bert
|
|
|
|
# LocalAI build binary
|
|
LocalAI
|
|
/local-ai
|
|
/local-ai-launcher
|
|
# Root-level build artifacts when running `go build ./...` against
|
|
# Go backend packages whose main lives under backend/go/.
|
|
/cloud-proxy
|
|
/local-store
|
|
/valkey-store
|
|
# prevent above rules from omitting the helm chart
|
|
!charts/*
|
|
# prevent above rules from omitting the api/localai folder
|
|
!api/localai
|
|
!core/**/localai
|
|
|
|
# Ignore models
|
|
models/*
|
|
test-models/
|
|
test-dir/
|
|
tests/e2e-aio/backends
|
|
# The mock backend binary built by `make build-mock-backend`. Anchored to its
|
|
# full path: a bare `mock-backend` also matched the *directory* holding the
|
|
# source, so git would not descend into it and adding a file there needed -f.
|
|
# tests/e2e/mock-backend/.gitignore covers the same binary; kept here too so
|
|
# the artifact stays ignored if that scoped file is ever removed.
|
|
/tests/e2e/mock-backend/mock-backend
|
|
|
|
release/
|
|
|
|
# just in case
|
|
.DS_Store
|
|
.idea
|
|
|
|
# Generated during build
|
|
backend-assets/*
|
|
!backend-assets/.keep
|
|
prepare
|
|
/ggml-metal.metal
|
|
docs/static/gallery.html
|
|
|
|
# Protobuf generated files
|
|
*.pb.go
|
|
*pb2.py
|
|
*pb2_grpc.py
|
|
|
|
# SonarQube
|
|
.scannerwork
|
|
|
|
# backend virtual environments
|
|
**/venv
|
|
|
|
# per-developer customization files for the development container
|
|
.devcontainer/customization/*
|
|
|
|
# Coverage profiles (the committed baseline is coverage-baseline.txt)
|
|
/coverage/
|
|
|
|
# React UI build artifacts (keep placeholder dist/index.html)
|
|
core/http/react-ui/node_modules/
|
|
core/http/react-ui/dist
|
|
|
|
# React UI coverage (vite-plugin-istanbul + nyc, via `make test-ui-coverage`)
|
|
core/http/react-ui/.nyc_output/
|
|
core/http/react-ui/coverage/
|
|
|
|
# Extracted backend binaries for container-based testing
|
|
local-backends/
|
|
|
|
# UI E2E test artifacts
|
|
tests/e2e-ui/ui-test-server
|
|
core/http/react-ui/playwright-report/
|
|
core/http/react-ui/test-results/
|
|
|
|
# Local worktrees
|
|
.worktrees/
|
|
|
|
# SDD / brainstorm scratch (agent-driven development)
|
|
.superpowers/
|
|
|
|
# Local Apple signing material (never commit)
|
|
.certs/
|
|
|
|
# Pinned dev tools (e.g. FizzBee for the realtime-conformance gate)
|
|
.tools/
|
|
|
|
# FizzBee model-check artifacts: the parser emits <spec>.json next to each
|
|
# .fizz and the checker writes run dirs under out/. Both are regenerated by
|
|
# the realtime-conformance gate; only the .fizz sources are authoritative.
|
|
formal-verification/*.json
|
|
formal-verification/out/
|
|
|
|
# `go build ./.github/ci/apexentries` drops a binary of the package name into
|
|
# whatever directory it runs in, one `git add -A` away from being committed.
|
|
# Both paths are anchored: an unanchored `apexentries` would also match the
|
|
# package directory itself and untrack the source.
|
|
/apexentries
|
|
/.github/ci/apexentries/apexentries
|