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

AzureSearchVectorStoreRetriever search_kwargs is empty #21473

Open
5 tasks done
JetQin opened this issue May 9, 2024 · 1 comment
Open
5 tasks done

AzureSearchVectorStoreRetriever search_kwargs is empty #21473

JetQin opened this issue May 9, 2024 · 1 comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: retriever Related to retriever module

Comments

@JetQin
Copy link

JetQin commented May 9, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

Missing __search_kwargs: dict = Field(default_factory=dict)_ fields in AzureSearchVectorStoreRetriever, we can't pass filter condition during query from vector db

Current code:


class AzureSearchVectorStoreRetriever(BaseRetriever):
    """Retriever that uses `Azure Cognitive Search`."""

    vectorstore: AzureSearch
    """Azure Search instance used to find similar documents."""
    search_type: str = "hybrid"
    """Type of search to perform. Options are "similarity", "hybrid",
    "semantic_hybrid", "similarity_score_threshold", "hybrid_score_threshold"."""
    k: int = 4
    """Number of documents to return."""
    allowed_search_types: ClassVar[Collection[str]] = (
    )

Previous Code:

class VectorStoreRetriever(BaseRetriever):
    """Base Retriever class for VectorStore."""

    vectorstore: VectorStore
    """VectorStore to use for retrieval."""
    search_type: str = "similarity"
    """Type of search to perform. Defaults to "similarity"."""
    _search_kwargs: dict = Field(default_factory=dict)
    """Keyword arguments to pass to the search function."""
    allowed_search_types: ClassVar[Collection[str]] = (
        "similarity",
        "similarity_score_threshold",
        "mmr",
    )

Error Message and Stack Trace (if applicable)

No response

Description

Can't pass filter expression to azure search

System Info

langchain-community==0.0.32 works well but in langchain-community==0.0.37 failed to get filter conditions

@dosubot dosubot bot added Ɑ: retriever Related to retriever module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels May 9, 2024
@liugddx
Copy link
Contributor

liugddx commented May 12, 2024

Let me see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: retriever Related to retriever module
Projects
None yet
Development

No branches or pull requests

2 participants