Skip to content
New issue

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

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

Already on GitHub? # to your account

weaviate: Add-deprecation-warning #29757

Merged
merged 11 commits into from
Feb 17, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
from typing import Any, Dict, List, Optional, cast
from uuid import uuid4

from langchain_core._api import deprecated
from langchain_core.callbacks import CallbackManagerForRetrieverRun
from langchain_core.documents import Document
from langchain_core.retrievers import BaseRetriever
from pydantic import ConfigDict, model_validator


@deprecated(
since="0.3.18",
removal="1.0",
alternative_import="langchain_weaviate.WeaviateVectorStore",
)
class WeaviateHybridSearchRetriever(BaseRetriever):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do replacements for WeaviateHybridSearchRetriever and WeaviateTranslator exist in langchain-weaviate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A replacement for WeaviateHybridSearchRetriever already exists in langchain-weaviate.

WeaviateTranslator has no replacement.

Before discussing migration, what’s the intended scope of WeaviateTranslator?

  • Just simple natural language (NL) queries?, or
  • Full support for every Weaviate search feature?

Weaviate has introduced many new query features over the years (multi-tenancy, named vectors, multi-target search). If WeaviateTranslator is meant to support everything, I'm not sure LLM-based structured query generation can reliably handle this. If it’s just for basic NL queries, we can scope an update accordingly.

Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NL queries is likely fine. WeaviateTranslator is used to support LLM-generated filters and other structured queries (see docs here). I removed the warning on that module for now. If/when it's supported in langchain-weaviate we can deprecate it in community.

Copy link
Contributor Author

@hsm207 hsm207 Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccurme What's the expected behaviour if the user NL query can't be parsed correctly? For example:

This will work:

I want to watch a movie rated higher than 8.5

But this won't, because the translator does not support parsing multi tenancy-related terms, although I see the the prompt the LLM use could theoretically be tweaked to extract it from the natural language query:

I want to watch a movie rated higher than 8.5 in tenant A

Do we just pass the query to the vector db and let it throw an exception or are there some checks being done earlier?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detecting unsupported features and raising an exception is ideal.

Letting DB throw an exception is OK. My main concern is making sure that, if there are current users of self-query retriever with weaviate and we deprecate the community integration, we can give concrete instructions about what we recommend they do.

"""`Weaviate hybrid search` retriever.

Expand Down
6 changes: 6 additions & 0 deletions libs/community/langchain_community/vectorstores/weaviate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from uuid import uuid4

import numpy as np
from langchain_core._api import deprecated
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VectorStore
Expand Down Expand Up @@ -65,6 +66,11 @@ def _json_serializable(value: Any) -> Any:
return value


@deprecated(
since="0.3.18",
removal="1.0",
alternative_import="langchain_weaviate.WeaviateVectorStore",
)
class Weaviate(VectorStore):
"""`Weaviate` vector store.

Expand Down
Loading