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

Bugfix langchain astradb metadata #4361

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Conversation

erichare
Copy link
Collaborator

@erichare erichare commented Nov 1, 2024

This pull request fixes a bug in the Astra DB component which passes empty lists for the metadata include and exclude parameters, where the underlying langchain-astradb code explicitly expects them to be None (and providing empty lists for both results in an error).

        """
        Validate the constructor indexing parameters and normalize them
        into a ready-to-use dict for the 'options' when creating a collection.
        """
        params = [
            metadata_indexing_include,
            metadata_indexing_exclude,
            collection_indexing_policy,
        ]
        if params.count(None) < len(params) - 1:
            msg = (
                "At most one of the parameters `metadata_indexing_include`,"
                " `metadata_indexing_exclude` and `collection_indexing_policy`"
                " can be specified as non null."
            )
            raise ValueError(msg)

@erichare erichare requested a review from cbornet November 1, 2024 22:04
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Nov 1, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 1, 2024
@erichare erichare merged commit e648689 into main Nov 1, 2024
37 of 45 checks passed
@erichare erichare deleted the bugfix-langchain-astradb-metadata branch November 1, 2024 22:39
ogabrielluiz pushed a commit that referenced this pull request Nov 4, 2024
* bugfix: langchain-astradb expects None or Iterable

* Update astradb.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants