From 7da0c4f7f013b0fe25302e25461deec2d034a57e Mon Sep 17 00:00:00 2001 From: James Briggs <james.briggs@hotmail.com> Date: Wed, 15 May 2024 11:18:34 +0800 Subject: [PATCH] chore: add deprecation warnings for splitters --- poetry.lock | 6 +++--- semantic_router/splitters/consecutive_sim.py | 7 +++++++ semantic_router/splitters/cumulative_sim.py | 7 +++++++ semantic_router/splitters/rolling_window.py | 7 +++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 33839cf8..ed829510 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "annotated-types" @@ -902,11 +902,11 @@ files = [ google-auth = ">=2.14.1,<3.0.dev0" googleapis-common-protos = ">=1.56.2,<2.0.dev0" grpcio = [ - {version = ">=1.33.2,<2.0dev", optional = true, markers = "extra == \"grpc\""}, + {version = ">=1.33.2,<2.0dev", optional = true, markers = "python_version < \"3.11\" and extra == \"grpc\""}, {version = ">=1.49.1,<2.0dev", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""}, ] grpcio-status = [ - {version = ">=1.33.2,<2.0.dev0", optional = true, markers = "extra == \"grpc\""}, + {version = ">=1.33.2,<2.0.dev0", optional = true, markers = "python_version < \"3.11\" and extra == \"grpc\""}, {version = ">=1.49.1,<2.0.dev0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""}, ] proto-plus = ">=1.22.3,<2.0.0dev" diff --git a/semantic_router/splitters/consecutive_sim.py b/semantic_router/splitters/consecutive_sim.py index 897baae4..491860ec 100644 --- a/semantic_router/splitters/consecutive_sim.py +++ b/semantic_router/splitters/consecutive_sim.py @@ -1,4 +1,5 @@ from typing import Any, List +from warnings import warn import numpy as np @@ -18,6 +19,12 @@ class ConsecutiveSimSplitter(BaseSplitter): name: str = "consecutive_similarity_splitter", score_threshold: float = 0.45, ): + warn( + "Splitters are being deprecated. They have moved to their own " + "package. Please install the `semantic-chunkers` package. More " + "information can be found at:\n" + "https://github.com/aurelio-ai/semantic-chunkers" + ) super().__init__(name=name, encoder=encoder) encoder.score_threshold = score_threshold self.score_threshold = score_threshold diff --git a/semantic_router/splitters/cumulative_sim.py b/semantic_router/splitters/cumulative_sim.py index 0e50a354..f10a6407 100644 --- a/semantic_router/splitters/cumulative_sim.py +++ b/semantic_router/splitters/cumulative_sim.py @@ -1,4 +1,5 @@ from typing import List +from warnings import warn import numpy as np @@ -19,6 +20,12 @@ class CumulativeSimSplitter(BaseSplitter): name: str = "cumulative_similarity_splitter", score_threshold: float = 0.45, ): + warn( + "Splitters are being deprecated. They have moved to their own " + "package. Please install the `semantic-chunkers` package. More " + "information can be found at:\n" + "https://github.com/aurelio-ai/semantic-chunkers" + ) super().__init__(name=name, encoder=encoder) encoder.score_threshold = score_threshold self.score_threshold = score_threshold diff --git a/semantic_router/splitters/rolling_window.py b/semantic_router/splitters/rolling_window.py index fb4ce20a..05978911 100644 --- a/semantic_router/splitters/rolling_window.py +++ b/semantic_router/splitters/rolling_window.py @@ -1,5 +1,6 @@ from dataclasses import dataclass from typing import List +from warnings import warn import numpy as np @@ -49,6 +50,12 @@ class RollingWindowSplitter(BaseSplitter): plot_splits=False, enable_statistics=False, ): + warn( + "Splitters are being deprecated. They have moved to their own " + "package. Please install the `semantic-chunkers` package. More " + "information can be found at:\n" + "https://github.com/aurelio-ai/semantic-chunkers" + ) super().__init__(name=name, encoder=encoder) self.calculated_threshold: float self.encoder = encoder -- GitLab