From 340fd98b4295bd228c9369eecf745a8fd85bbde6 Mon Sep 17 00:00:00 2001 From: Ayush Chaurasia Date: Mon, 15 Jan 2024 12:19:51 +0530 Subject: [PATCH] chore(python): get rid of Pydantic deprication warning in embedding fcn (#816) ``` UserWarning: Valid config keys have changed in V2: * 'keep_untouched' has been renamed to 'ignored_types' warnings.warn(message, UserWarning) ``` --- python/lancedb/embeddings/gemini_text.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/lancedb/embeddings/gemini_text.py b/python/lancedb/embeddings/gemini_text.py index 314b1e02..d71ec7f5 100644 --- a/python/lancedb/embeddings/gemini_text.py +++ b/python/lancedb/embeddings/gemini_text.py @@ -20,6 +20,7 @@ import numpy as np from .base import TextEmbeddingFunction from .registry import register from .utils import api_key_not_found_help, TEXT +from lancedb.pydantic import PYDANTIC_VERSION @register("gemini-text") @@ -78,8 +79,10 @@ class GeminiText(TextEmbeddingFunction): query_task_type: str = "retrieval_query" source_task_type: str = "retrieval_document" - class Config: # Pydantic 1.x compat - keep_untouched = (cached_property,) + if PYDANTIC_VERSION < (2, 0): # Pydantic 1.x compat + + class Config: + keep_untouched = (cached_property,) def ndims(self): # TODO: fix hardcoding