Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush3011 committed Dec 14, 2024
1 parent 2da2db9 commit 7adc341
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def _hybrid_search_with_score(
k: int = 4,
pre_filter: Optional[Dict[str, Any]] = None,
with_embedding: bool = False,
offset_limit: str = "",
offset_limit: Optional[str] = None,
*,
projection_mapping: Optional[Dict[str, Any]] = None,
**kwargs: Any,
Expand Down Expand Up @@ -576,11 +576,15 @@ def _construct_query(
# TODO: Update the code to use parameters once parametrized queries
# are allowed for these query functions
if query_type == CosmosDBQueryType.FULL_TEXT_RANK:
if search_text is None:
raise ValueError("search text cannot be None for FULL_TEXT_RANK queries.")

Check failure on line 580 in libs/community/langchain_community/vectorstores/azure_cosmos_db_no_sql.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.13

Ruff (E501)

langchain_community/vectorstores/azure_cosmos_db_no_sql.py:580:89: E501 Line too long (90 > 88)

Check failure on line 580 in libs/community/langchain_community/vectorstores/azure_cosmos_db_no_sql.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.9

Ruff (E501)

langchain_community/vectorstores/azure_cosmos_db_no_sql.py:580:89: E501 Line too long (90 > 88)
query += f""" ORDER BY RANK FullTextScore(c.{self._text_key},
[{", ".join(f"'{term}'" for term in search_text.split())}])"""
elif query_type == CosmosDBQueryType.VECTOR:
query += " ORDER BY VectorDistance(c[@embeddingKey], @embeddings)"
elif query_type == CosmosDBQueryType.HYBRID:
if search_text is None:
raise ValueError("search text cannot be None for HYBRID queries.")
query += f""" ORDER BY RANK RRF(FullTextScore(c.{self._text_key},
[{", ".join(f"'{term}'" for term in search_text.split())}]),
VectorDistance(c.{self._embedding_key}, {embeddings}))"""
Expand Down Expand Up @@ -661,7 +665,7 @@ def _build_parameters(
search_terms: Optional[List[str]] = None,
projection_mapping: Optional[Dict[str, Any]] = None,
) -> List[Dict[str, Any]]:
parameters = [
parameters: List[Dict[str, Any]] = [
{"name": "@limit", "value": k},
{"name": "@textKey", "value": self._text_key},
]
Expand Down

0 comments on commit 7adc341

Please sign in to comment.