From 878da6c328a9213a3b7d7a7e9956116493a5cedc Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Wed, 18 Sep 2024 07:13:13 -0400 Subject: [PATCH] remove compatibility mode for nvolveqa_40k embedding model --- .../langchain_nvidia_ai_endpoints/_statics.py | 2 -- .../langchain_nvidia_ai_endpoints/embeddings.py | 10 ---------- .../tests/integration_tests/test_embeddings.py | 15 --------------- 3 files changed, 27 deletions(-) diff --git a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_statics.py b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_statics.py index 2f00b4ce..cbae107e 100644 --- a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_statics.py +++ b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_statics.py @@ -501,8 +501,6 @@ def validate_client(cls, client: str, values: dict) -> str: endpoint="https://ai.api.nvidia.com/v1/retrieval/nvidia/embeddings", aliases=[ "ai-embed-qa-4", - "playground_nvolveqa_40k", - "nvolveqa_40k", ], ), "nvidia/nv-embed-v1": Model( diff --git a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/embeddings.py b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/embeddings.py index 943f1a3d..2f3adab2 100644 --- a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/embeddings.py +++ b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/embeddings.py @@ -96,16 +96,6 @@ def __init__(self, **kwargs: Any): # same for base_url self.base_url = self._client.base_url - # todo: remove when nvolveqa_40k is removed from MODEL_TABLE - if "model" in kwargs and kwargs["model"] in [ - "playground_nvolveqa_40k", - "nvolveqa_40k", - ]: - warnings.warn( - 'Setting truncate="END" for nvolveqa_40k backward compatibility' - ) - self.truncate = "END" - @validator("model_type") def _validate_model_type( cls, v: Optional[Literal["passage", "query"]] diff --git a/libs/ai-endpoints/tests/integration_tests/test_embeddings.py b/libs/ai-endpoints/tests/integration_tests/test_embeddings.py index 2316b1e4..3eb569fb 100644 --- a/libs/ai-endpoints/tests/integration_tests/test_embeddings.py +++ b/libs/ai-endpoints/tests/integration_tests/test_embeddings.py @@ -52,8 +52,6 @@ async def test_embed_documents_multiple_async(embedding_model: str, mode: dict) def test_embed_query_long_text(embedding_model: str, mode: dict) -> None: - if embedding_model in ["playground_nvolveqa_40k", "nvolveqa_40k"]: - pytest.skip("Skip test for nvolveqa-40k due to compat override of truncate") embedding = NVIDIAEmbeddings(model=embedding_model, **mode) text = "nvidia " * 10240 with pytest.raises(Exception): @@ -70,8 +68,6 @@ def test_embed_documents_batched_texts(embedding_model: str, mode: dict) -> None def test_embed_documents_mixed_long_texts(embedding_model: str, mode: dict) -> None: - if embedding_model in ["playground_nvolveqa_40k", "nvolveqa_40k"]: - pytest.skip("Skip test for nvolveqa-40k due to compat override of truncate") embedding = NVIDIAEmbeddings(model=embedding_model, **mode) count = NVIDIAEmbeddings._default_max_batch_size * 2 - 1 texts = ["nvidia " * 32] * count @@ -100,17 +96,6 @@ def test_embed_documents_truncate( assert len(output) == count -@pytest.mark.parametrize("nvolveqa_40k", ["playground_nvolveqa_40k", "nvolveqa_40k"]) -def test_embed_nvolveqa_40k_compat(nvolveqa_40k: str, mode: dict) -> None: - if mode: - pytest.skip("Test only relevant for API Catalog") - with pytest.warns(UserWarning): - embedding = NVIDIAEmbeddings(model=nvolveqa_40k, truncate="NONE", **mode) - text = "nvidia " * 2048 - output = embedding.embed_query(text) - assert len(output) > 3 - - # todo: test model_type ("passage" and embed_query, # "query" and embed_documents; compare results) # todo: test max_length > max length accepted by the model