Skip to content

Commit

Permalink
try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
duwenxin99 committed Sep 9, 2024
1 parent c59cb49 commit 563ad77
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/langchain_google_alloydb_pg/vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ async def aadd_images(
if hasattr(self.embedding_service, "embed_image"):
try:
embeddings = self.embedding_service.embed_image(images)
except TypeError as e:
raise TypeError(
f"Embedding model used does not support a list of image URIs as input. {str(e)}"
except Exception as e:
raise Exception(
f"Make sure your selected embedding model supports list of image URIs as input. {str(e)}"
)
else:
raise ValueError(
Expand Down Expand Up @@ -700,9 +700,9 @@ def _embedding_helper(
if hasattr(self.embedding_service, "embed_image"):
try:
embedding = self.embedding_service.embed_image([image_uri])[0]
except TypeError as e:
raise TypeError(
f"Embedding model used does not support a list of image URIs as input. {str(e)}"
except Exception as e:
raise Exception(
f"Make sure your selected embedding model supports list of image URIs as input. {str(e)}"
)
else:
raise ValueError(
Expand Down Expand Up @@ -831,7 +831,7 @@ async def _asimilarity_search_with_relevance_scores( # type: ignore[override]
k: Number of Documents to return. Defaults to 4.
**kwargs: kwargs to be passed to similarity search. Should include:
score_threshold: Optional, a floating point value between 0 to 1 to
filter the resulting set of retrieved docs.
filter the resulting set of retrieved docs.
Returns:
List of Tuples of (doc, similarity_score)
Expand Down Expand Up @@ -860,7 +860,7 @@ def _similarity_search_with_relevance_scores( # type: ignore[override]
k: Number of Documents to return. Defaults to 4.
**kwargs: kwargs to be passed to similarity search. Should include:
score_threshold: Optional, a floating point value between 0 to 1 to
filter the resulting set of retrieved docs
filter the resulting set of retrieved docs
Returns:
List of Tuples of (doc, similarity_score)
Expand All @@ -887,7 +887,7 @@ def similarity_search_with_relevance_scores( # type: ignore[override]
k: Number of Documents to return. Defaults to 4.
**kwargs: kwargs to be passed to similarity search. Should include:
score_threshold: Optional, a floating point value between 0 to 1 to
filter the resulting set of retrieved docs.
filter the resulting set of retrieved docs.
Returns:
List of Tuples of (doc, similarity_score).
Expand Down Expand Up @@ -935,7 +935,7 @@ async def asimilarity_search_with_relevance_scores( # type: ignore[override]
k: Number of Documents to return. Defaults to 4.
**kwargs: kwargs to be passed to similarity search. Should include:
score_threshold: Optional, a floating point value between 0 to 1 to
filter the resulting set of retrieved docs
filter the resulting set of retrieved docs
Returns:
List of Tuples of (doc, similarity_score)
Expand Down

0 comments on commit 563ad77

Please sign in to comment.