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

feat: add indexing methods #21

Merged
merged 10 commits into from
Feb 14, 2024
Merged

feat: add indexing methods #21

merged 10 commits into from
Feb 14, 2024

Conversation

averikitsch
Copy link
Collaborator

Instead of #12

@averikitsch averikitsch requested a review from a team as a code owner February 13, 2024 18:00
@product-auto-label product-auto-label bot added the api: cloudsql-postgres Issues related to the googleapis/langchain-google-cloud-sql-pg-python API. label Feb 13, 2024
src/langchain_google_cloud_sql_pg/cloudsql_vectorstore.py Outdated Show resolved Hide resolved
src/langchain_google_cloud_sql_pg/cloudsql_vectorstore.py Outdated Show resolved Hide resolved
async def aapply_vector_index(
self,
index: BaseIndex,
name: Optional[str] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this allow a Vector object as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you add more? Since I have this on the vector store I don't think so?

Copy link
Collaborator

Choose a reason for hiding this comment

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

should be able to do this: (might need to use Union[str, BaseIndex] depends on when the other format was added python version wise)

Suggested change
name: Optional[str] = None,
name: Optional[str | BaseIndex] = None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are already requiring a BaseIndex as the index argument, why does name need to support BaseIndex as well?

src/langchain_google_cloud_sql_pg/cloudsql_vectorstore.py Outdated Show resolved Hide resolved
async def aapply_vector_index(
self,
index: BaseIndex,
name: Optional[str] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be able to do this: (might need to use Union[str, BaseIndex] depends on when the other format was added python version wise)

Suggested change
name: Optional[str] = None,
name: Optional[str | BaseIndex] = None,
src/langchain_google_cloud_sql_pg/cloudsql_vectorstore.py Outdated Show resolved Hide resolved
src/langchain_google_cloud_sql_pg/cloudsql_vectorstore.py Outdated Show resolved Hide resolved
Comment on lines 424 to 425
if isinstance(index, ExactNearestNeighbor):
return None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dumb question -- should we delete an index with the name if it already exists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not dumb! We did talk about this and I agree we should drop

src/langchain_google_cloud_sql_pg/indexes.py Outdated Show resolved Hide resolved
averikitsch and others added 4 commits February 13, 2024 14:13
Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
@averikitsch averikitsch merged commit 8eae440 into main Feb 14, 2024
7 checks passed
@averikitsch averikitsch deleted the akitsch-indexes branch February 14, 2024 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudsql-postgres Issues related to the googleapis/langchain-google-cloud-sql-pg-python API.
2 participants