Skip to content

Commit

Permalink
Merge pull request #103 from langchain-ai/mattf/remove-nvolveqa-40k
Browse files Browse the repository at this point in the history
remove compatibility mode for nvolveqa_40k embedding model
  • Loading branch information
mattf authored Sep 21, 2024
2 parents c73b9b6 + 66ba038 commit 2c82168
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
2 changes: 0 additions & 2 deletions libs/ai-endpoints/langchain_nvidia_ai_endpoints/_statics.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,6 @@ def validate_client(self) -> "Model":
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(
Expand Down
11 changes: 0 additions & 11 deletions libs/ai-endpoints/langchain_nvidia_ai_endpoints/embeddings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Embeddings Components Derived from NVEModel/Embeddings"""

import warnings
from typing import Any, List, Literal, Optional

from langchain_core.embeddings import Embeddings
Expand Down Expand Up @@ -97,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"

@property
def available_models(self) -> List[Model]:
"""
Expand Down
15 changes: 0 additions & 15 deletions libs/ai-endpoints/tests/integration_tests/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,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):
Expand All @@ -71,8 +69,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 = _DEFAULT_BATCH_SIZE * 2 - 1
texts = ["nvidia " * 32] * count
Expand Down Expand Up @@ -101,16 +97,5 @@ 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 max_length > max length accepted by the model
# todo: test max_batch_size > max batch size accepted by the model

0 comments on commit 2c82168

Please sign in to comment.