From 0729eb9b3bfdceff0e1d87844451733be2bc5506 Mon Sep 17 00:00:00 2001 From: James Briggs <james.briggs@hotmail.com> Date: Wed, 28 Aug 2024 22:17:02 +0200 Subject: [PATCH] fix: python 3.9 backwards compatibility --- semantic_router/index/base.py | 2 +- semantic_router/index/local.py | 2 +- semantic_router/index/pinecone.py | 2 +- semantic_router/index/postgres.py | 2 +- semantic_router/index/qdrant.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/semantic_router/index/base.py b/semantic_router/index/base.py index 750e5d87..44bbecf9 100644 --- a/semantic_router/index/base.py +++ b/semantic_router/index/base.py @@ -26,7 +26,7 @@ class BaseIndex(BaseModel): embeddings: List[List[float]], routes: List[str], utterances: List[Any], - function_schemas: List[Dict[str, Any]] | None = None, + function_schemas: Optional[List[Dict[str, Any]]] = None, ): """ Add embeddings to the index. diff --git a/semantic_router/index/local.py b/semantic_router/index/local.py index be4b48dd..e979c40b 100644 --- a/semantic_router/index/local.py +++ b/semantic_router/index/local.py @@ -27,7 +27,7 @@ class LocalIndex(BaseIndex): embeddings: List[List[float]], routes: List[str], utterances: List[str], - function_schemas: List[Dict[str, Any]] | None = None, + function_schemas: Optional[List[Dict[str, Any]]] = None, ): embeds = np.array(embeddings) # type: ignore routes_arr = np.array(routes) diff --git a/semantic_router/index/pinecone.py b/semantic_router/index/pinecone.py index 26e0b40e..875a488c 100644 --- a/semantic_router/index/pinecone.py +++ b/semantic_router/index/pinecone.py @@ -399,7 +399,7 @@ class PineconeIndex(BaseIndex): embeddings: List[List[float]], routes: List[str], utterances: List[str], - function_schemas: List[Dict[str, Any]] | None = None, + function_schemas: Optional[List[Dict[str, Any]]] = None, batch_size: int = 100, ): """Add vectors to Pinecone in batches.""" diff --git a/semantic_router/index/postgres.py b/semantic_router/index/postgres.py index b4e133fe..0d18381f 100644 --- a/semantic_router/index/postgres.py +++ b/semantic_router/index/postgres.py @@ -259,7 +259,7 @@ class PostgresIndex(BaseIndex): embeddings: List[List[float]], routes: List[str], utterances: List[Any], - function_schemas: List[Dict[str, Any]] | None = None, + function_schemas: Optional[List[Dict[str, Any]]] = None, ) -> None: """ Adds vectors to the index. diff --git a/semantic_router/index/qdrant.py b/semantic_router/index/qdrant.py index 11a0a076..ec809577 100644 --- a/semantic_router/index/qdrant.py +++ b/semantic_router/index/qdrant.py @@ -179,7 +179,7 @@ class QdrantIndex(BaseIndex): embeddings: List[List[float]], routes: List[str], utterances: List[str], - function_schemas: List[Dict[str, Any]] | None = None, + function_schemas: Optional[List[Dict[str, Any]]] = None, batch_size: int = DEFAULT_UPLOAD_BATCH_SIZE, ): self.dimensions = self.dimensions or len(embeddings[0]) -- GitLab