community: fix AttributeError when creating LanceDB vectorstore (#30127)

**Description:**

This PR adds a call to `guard_import()` to fix an AttributeError raised
when creating LanceDB vectorstore instance with an existing LanceDB
table.

**Issue:**

This PR fixes issue #30124.

**Dependencies:**

No additional dependencies.

**Twitter handle:**

[@metadaddy](https://x.com/metadaddy), but I spend more time at
[@metadaddy.net](https://bsky.app/profile/metadaddy.net) these days.

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
Pat Patterson 2025-03-05 15:04:38 -08:00 committed by GitHub
parent 9b7b8e4a1a
commit b3dc66f7a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,6 +75,7 @@ class LanceDB(VectorStore):
):
"""Initialize with Lance DB vectorstore"""
lancedb = guard_import("lancedb")
lancedb.remote.table = guard_import("lancedb.remote.table")
self._embedding = embedding
self._vector_key = vector_key
self._id_key = id_key