diff --git a/docs/VALKEY_SEARCH_INTEGRATION.md b/docs/VALKEY_SEARCH_INTEGRATION.md index aa95b0e70..c1db2a2e1 100644 --- a/docs/VALKEY_SEARCH_INTEGRATION.md +++ b/docs/VALKEY_SEARCH_INTEGRATION.md @@ -31,8 +31,10 @@ Both are compatible with LangBot. ## Installation -Valkey Search support is included when you install LangBot — the `valkey-glide` dependency is -declared in `pyproject.toml`. To install manually: +Valkey Search support is included automatically on Linux and macOS. The official `valkey-glide` +client does not currently publish a Windows package, so LangBot skips this optional dependency on +Windows; LangBot remains usable there, but the Valkey Search backend is unavailable. To install the +client manually on a supported platform: ```bash pip install 'valkey-glide>=2.4.1,<3.0.0' diff --git a/pyproject.toml b/pyproject.toml index 3204bd35d..c528bcefe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,7 @@ dependencies = [ "pgvector>=0.4.1", "botocore>=1.42.39", "litellm>=1.0.0", - "valkey-glide>=2.4.1,<3.0.0", + "valkey-glide>=2.4.1,<3.0.0; sys_platform != 'win32'", # No Windows wheels are published ] keywords = [ "bot", diff --git a/src/langbot/pkg/vector/vdbs/valkey_search.py b/src/langbot/pkg/vector/vdbs/valkey_search.py index 9f92acc97..c40f970be 100644 --- a/src/langbot/pkg/vector/vdbs/valkey_search.py +++ b/src/langbot/pkg/vector/vdbs/valkey_search.py @@ -119,7 +119,8 @@ class ValkeySearchVectorDatabase(VectorDatabase): def __init__(self, ap: app.Application): if not VALKEY_SEARCH_AVAILABLE: raise ImportError( - "valkey-glide is not installed. Install it with: pip install 'valkey-glide>=2.4.1,<3.0.0'" + "valkey-glide is not installed or is unavailable on this platform. " + "On Linux or macOS, install it with: pip install 'valkey-glide>=2.4.1,<3.0.0'" ) self.ap = ap diff --git a/tests/integration/vector/test_valkey_search.py b/tests/integration/vector/test_valkey_search.py index 64349987b..4368a2bb0 100644 --- a/tests/integration/vector/test_valkey_search.py +++ b/tests/integration/vector/test_valkey_search.py @@ -77,11 +77,12 @@ async def backend(valkey_config): ValkeySearchVectorDatabase, VALKEY_SEARCH_AVAILABLE, ) - from glide import ft if not VALKEY_SEARCH_AVAILABLE: pytest.skip('valkey-glide not installed') + from glide import ft + ap = _make_ap(valkey_config) db = ValkeySearchVectorDatabase(ap) client = await db._ensure_client() diff --git a/tests/unit_tests/vector/test_valkey_search_filter.py b/tests/unit_tests/vector/test_valkey_search_filter.py index 7439712dd..f2f35f074 100644 --- a/tests/unit_tests/vector/test_valkey_search_filter.py +++ b/tests/unit_tests/vector/test_valkey_search_filter.py @@ -357,10 +357,13 @@ class TestCredentialsBuild: cred_calls.append(kwargs) return ('CRED', kwargs) - monkeypatch.setattr(mod, 'GlideClient', _FakeClient) - monkeypatch.setattr(mod, 'ServerCredentials', _fake_credentials) - monkeypatch.setattr(mod, 'GlideClientConfiguration', lambda **kw: kw) - monkeypatch.setattr(mod, 'NodeAddress', lambda *a, **k: ('node', a, k)) + # These names are absent when the optional valkey-glide dependency is + # unavailable (for example, on Windows), so allow the test doubles to + # create them on the module. + monkeypatch.setattr(mod, 'GlideClient', _FakeClient, raising=False) + monkeypatch.setattr(mod, 'ServerCredentials', _fake_credentials, raising=False) + monkeypatch.setattr(mod, 'GlideClientConfiguration', lambda **kw: kw, raising=False) + monkeypatch.setattr(mod, 'NodeAddress', lambda *a, **k: ('node', a, k), raising=False) return backend, created, cred_calls, warnings async def test_username_without_password_fails_closed(self, monkeypatch): diff --git a/uv.lock b/uv.lock index 3e4b2a124..97231f514 100644 --- a/uv.lock +++ b/uv.lock @@ -2084,7 +2084,7 @@ dependencies = [ { name = "tiktoken" }, { name = "urllib3" }, { name = "uv" }, - { name = "valkey-glide" }, + { name = "valkey-glide", marker = "sys_platform != 'win32'" }, { name = "websockets" }, ] @@ -2173,7 +2173,7 @@ requires-dist = [ { name = "tiktoken", specifier = ">=0.9.0" }, { name = "urllib3", specifier = ">=2.7.0" }, { name = "uv", specifier = ">=0.11.15" }, - { name = "valkey-glide", specifier = ">=2.4.1,<3.0.0" }, + { name = "valkey-glide", marker = "sys_platform != 'win32'", specifier = ">=2.4.1,<3.0.0" }, { name = "websockets", specifier = ">=15.0.1" }, ] @@ -5991,9 +5991,9 @@ name = "valkey-glide" version = "2.4.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "anyio" }, - { name = "protobuf" }, - { name = "sniffio" }, + { name = "anyio", marker = "sys_platform != 'win32'" }, + { name = "protobuf", marker = "sys_platform != 'win32'" }, + { name = "sniffio", marker = "sys_platform != 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/72/a2/582b34c6acc8dc857c537f6007459cba48dfa0dc404789a657e5c1a998c0/valkey_glide-2.4.1.tar.gz", hash = "sha256:f1155d84156d11b90488aa67e90102f0bf98a45314f5b99308ac9074c05f7241", size = 898030, upload-time = "2026-05-28T21:41:55.881Z" } wheels = [