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

BigQueryVectorStore assumes we are now creating the vector store #459

Closed
Shai-Di opened this issue Aug 21, 2024 · 2 comments
Closed

BigQueryVectorStore assumes we are now creating the vector store #459

Shai-Di opened this issue Aug 21, 2024 · 2 comments

Comments

@Shai-Di
Copy link

Shai-Di commented Aug 21, 2024

If we already have an existing VectorStore in BigQuery and we just want to connect to it and fetch documents from it, the _create_search_query method crashes when using filters, since self.table_schema is not initialized, due to these lines:

if filter:
            filter_expressions = []
            for column, value in filter.items():
                if self.table_schema[column] in ["INTEGER", "FLOAT"]:  # type: ignore[index]
                    filter_expressions.append(f"base.{column} = {value}")
                else:
                    filter_expressions.append(f"base.{column} = '{value}'")
            where_filter_expr = " AND ".join(filter_expressions)
        else:
            where_filter_expr = "TRUE"

Fixed it locally by changing it to:

if filter:
            if not self.table_schema:
                self._validate_bq_table()
            filter_expressions = []
            for column, value in filter.items():
                if self.table_schema[column] in ["INTEGER", "FLOAT"]:  # type: ignore[index]
                    filter_expressions.append(f"base.{column} = {value}")
                else:
                    filter_expressions.append(f"base.{column} = '{value}'")
            where_filter_expr = " AND ".join(filter_expressions)
        else:
            where_filter_expr = "TRUE"
@lkuligin
Copy link
Collaborator

@eliasecchig

@eliasecchig
Copy link
Contributor

thanks for flagging this @Shai-Di, will prepare a PR tomorrow to fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants