Skip to content

Commit

Permalink
resolve lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Sep 9, 2024
1 parent 7d8c6f6 commit 5a94094
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def initialize_bq_vector_index(self) -> Self:
self._have_index = self._have_index
self._last_index_check = self._last_index_check

if (self._have_index or None) or (self._creating_index or None):
if self._have_index or self._creating_index:
return self

table = self._bq_client.get_table(self._full_table_id) # type: ignore[union-attr]
Expand Down Expand Up @@ -567,7 +567,9 @@ def to_vertex_fs_vector_store(self, **kwargs: Any) -> Any:
VertexFSVectorStore,
)

base_params = self.dict(include=BaseBigQueryVectorStore.__fields__.keys())
base_params = self.model_dump(
include=set(BaseBigQueryVectorStore.model_fields.keys())
)
base_params["embedding"] = self.embedding
all_params = {**base_params, **kwargs}
fs_obj = VertexFSVectorStore(**all_params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def _initialize_bq_vector_index(self) -> Self:
self.algorithm_config = utils.TreeAhConfig()
if self.distance_measure_type is None:
self.distance_measure_type = utils.DistanceMeasureType.DOT_PRODUCT_DISTANCE
if (self.online_store_name or None) is None:
if self.online_store_name is None:
self.online_store_name = self.dataset_name
if (self.view_name or None) is None:
if self.view_name is None:
self.view_name = self.table_name

api_endpoint = f"{self.location}-aiplatform.googleapis.com"
Expand Down Expand Up @@ -513,7 +513,9 @@ def to_bq_vector_store(self, **kwargs: Any) -> Any:
BigQueryVectorStore,
)

base_params = self.dict(include=BaseBigQueryVectorStore.__fields__.keys())
base_params = self.model_dump(
include=set(BaseBigQueryVectorStore.model_fields.keys())
)
base_params["embedding"] = self.embedding
all_params = {**base_params, **kwargs}
bq_obj = BigQueryVectorStore(**all_params)
Expand Down
7 changes: 4 additions & 3 deletions libs/community/langchain_google_community/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from langchain_core.document_loaders import BaseLoader
from langchain_core.documents import Document
from pydantic import BaseModel, root_validator, validator
from pydantic import BaseModel, model_validator, validator

SCOPES = ["https://www.googleapis.com/auth/drive.file"]

Expand Down Expand Up @@ -194,8 +194,9 @@ def _get_identity_metadata_from_id(self, id: str) -> List[str]:

return authorized_identities

@root_validator
def validate_inputs(cls, values: Dict[str, Any]) -> Dict[str, Any]:
@model_validator(mode="before")
@classmethod
def validate_inputs(cls, values: Dict[str, Any]) -> Any:
"""Validate that either folder_id or document_ids is set, but not both."""
if values.get("folder_id") and (
values.get("document_ids") or values.get("file_ids")
Expand Down

0 comments on commit 5a94094

Please sign in to comment.