Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove compatibility mode for nvolveqa_40k embedding model #103

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading