Files
ai-agent/internal/ai/rag/vectordb/provider_test.go
T
mlogclub c3387ec4a9 feat: add LanceDB vector database provider
- Implemented LanceDBProvider for managing vector collections, including methods for creating, deleting, and searching collections.
- Added support for LanceDB configuration in VectorDBConfig.
- Introduced stub for LanceDB provider when not built with the appropriate tag.
- Updated provider initialization to include LanceDB as a supported type.
- Created types and interfaces for vector operations, including Vector, SearchRequest, and SearchResult.
- Added tests for VectorDBConfig unmarshalling and for ensuring proper error handling when LanceDB is not built.
- Updated enums to include LanceDB type and labels.
- Modified frontend enums to reflect the addition of LanceDB.
2026-06-07 17:32:29 +08:00

24 lines
536 B
Go

package vectordb
import (
"strings"
"testing"
"agent-desk/internal/pkg/config"
)
func TestInitLanceDBWithoutBuildTagReturnsActionableError(t *testing.T) {
err := Init(&config.VectorDBConfig{
Type: "lancedb",
LanceDB: config.LanceDBVectorDBConfig{
Path: "data/lancedb",
},
})
if err == nil {
t.Fatal("Init(lancedb) error = nil, want actionable build tag error")
}
if !strings.Contains(err.Error(), "LanceDB provider is not built") {
t.Fatalf("Init(lancedb) error = %q, want build tag guidance", err.Error())
}
}