fix: Pydantic 1.x compat for weak_lru caching in embeddings API (#643)

Colab has pydantic 1.x by default and pydantic 1.x BaseModel objects
don't support weakref creation by default that we use to cache embedding
models
https://github.com/lancedb/lancedb/blob/main/python/lancedb/embeddings/utils.py#L206
. It needs to be added to slot.
This commit is contained in:
Ayush Chaurasia
2023-11-10 15:02:38 +05:30
committed by GitHub
parent 1e8678f11a
commit ae0d2f2599

View File

@@ -33,6 +33,7 @@ class EmbeddingFunction(BaseModel, ABC):
3. ndims method which returns the number of dimensions of the vector column
"""
__slots__ = ("__weakref__",) # pydantic 1.x compatibility
max_retries: int = (
7 # Setitng 0 disables retires. Maybe this should not be enabled by default,
)