From 5a8091ff19bfe743e2ff3ef9450ab9b0d5e41a15 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 23 Sep 2024 12:14:17 +0100 Subject: [PATCH 1/3] Fix types --- pyproject.toml | 2 +- semantic_router/encoders/cohere.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 97d92edf..1b963c74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = "MIT" python = ">=3.9,<3.13" pydantic = "^2.5.3" openai = ">=1.10.0,<2.0.0" -cohere = ">=5.00,<6.00" +cohere = ">=5.9.4,<6.00" mistralai= {version = ">=0.0.12,<0.1.0", optional = true} numpy = "^1.25.2" colorlog = "^6.8.0" diff --git a/semantic_router/encoders/cohere.py b/semantic_router/encoders/cohere.py index 3fcac85c..01426e9f 100644 --- a/semantic_router/encoders/cohere.py +++ b/semantic_router/encoders/cohere.py @@ -2,7 +2,7 @@ from typing import List, Optional import cohere -from cohere.types.embed_response import EmbedResponse_EmbeddingsByType +from cohere.types.embed_response import EmbeddingsByTypeEmbedResponse from semantic_router.encoders import BaseEncoder from semantic_router.utils.defaults import EncoderDefault @@ -46,7 +46,7 @@ def __call__(self, docs: List[str]) -> List[List[float]]: texts=docs, input_type=self.input_type, model=self.name ) # Check for unsupported type. - if isinstance(embeds, EmbedResponse_EmbeddingsByType): + if isinstance(embeds, EmbeddingsByTypeEmbedResponse): raise NotImplementedError( "Handling of EmbedByTypeResponseEmbeddings is not implemented." ) From eb99b61cafd0da3b328e428ea6981157d2f1d31b Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 23 Sep 2024 12:41:54 +0100 Subject: [PATCH 2/3] Lock --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 20e471a7..3b67732f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -580,13 +580,13 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} [[package]] name = "cohere" -version = "5.9.0" +version = "5.9.4" description = "" optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "cohere-5.9.0-py3-none-any.whl", hash = "sha256:7c70cc9e6ade3355e00aa4a77fcb5662b32261a3237e00975d92b97bb5f3c0c9"}, - {file = "cohere-5.9.0.tar.gz", hash = "sha256:74e5b6e1fed0f617c26dfb8ef1cfccf8334321a51cc886c37374047916d71568"}, + {file = "cohere-5.9.4-py3-none-any.whl", hash = "sha256:d1b31d8ba32e338b3aa91737aa98dc74de8778ed8e397ab799739b5f060f44e7"}, + {file = "cohere-5.9.4.tar.gz", hash = "sha256:ed0fa256c51423175c208650dffcb534ae112dc3ab7703de352e2adaf99dd50b"}, ] [package.dependencies] From a997b9741a3e0193d972c9abe2239faa9e5f161d Mon Sep 17 00:00:00 2001 From: Ismail Ashraq Date: Mon, 23 Sep 2024 17:04:02 +0500 Subject: [PATCH 3/3] fix: cohere type --- semantic_router/encoders/cohere.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/semantic_router/encoders/cohere.py b/semantic_router/encoders/cohere.py index 3fcac85c..01426e9f 100644 --- a/semantic_router/encoders/cohere.py +++ b/semantic_router/encoders/cohere.py @@ -2,7 +2,7 @@ from typing import List, Optional import cohere -from cohere.types.embed_response import EmbedResponse_EmbeddingsByType +from cohere.types.embed_response import EmbeddingsByTypeEmbedResponse from semantic_router.encoders import BaseEncoder from semantic_router.utils.defaults import EncoderDefault @@ -46,7 +46,7 @@ def __call__(self, docs: List[str]) -> List[List[float]]: texts=docs, input_type=self.input_type, model=self.name ) # Check for unsupported type. - if isinstance(embeds, EmbedResponse_EmbeddingsByType): + if isinstance(embeds, EmbeddingsByTypeEmbedResponse): raise NotImplementedError( "Handling of EmbedByTypeResponseEmbeddings is not implemented." )