Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich committed Jan 28, 2025
1 parent e998447 commit 3bb39d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ Pipfile.lock
# pyright
pyrightconfig.json

poetry.lock
poetry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,20 @@ class AzureAISearchVectorStore(BasePydanticVectorStore):
_field_names: Dict[str, str] = PrivateAttr()
_field_mapping: Dict[str, SearchField] = PrivateAttr()
_index_management: IndexManagement = PrivateAttr()
_index_mapping: Callable[[Dict[str, str], Dict[str, Any]], Dict[str, str]] = (
PrivateAttr()
)
_metadata_to_index_field_map: Dict[str, Tuple[str, MetadataIndexFieldType]] = (
PrivateAttr()
)
_index_mapping: Callable[
[Dict[str, str], Dict[str, Any]], Dict[str, str]
] = PrivateAttr()
_metadata_to_index_field_map: Dict[
str, Tuple[str, MetadataIndexFieldType]
] = PrivateAttr()
_vector_profile_name: str = PrivateAttr()
_semantic_config_name: str = PrivateAttr()
_compression_type: str = PrivateAttr()
_semantic_config: Optional[SemanticConfiguration | str | None] = PrivateAttr()
_vector_search_profile: Optional[VectorSearchProfile | str | None] = PrivateAttr()
_vector_search_algorithm: Optional[Literal["hnsw", "exhaustiveKnn"] | None] = (
PrivateAttr()
)
_vector_search_algorithm: Optional[
Literal["hnsw", "exhaustiveKnn"] | None
] = PrivateAttr()
_user_agent: str = PrivateAttr()

def _normalise_metadata_to_index_fields(
Expand Down Expand Up @@ -203,9 +203,9 @@ def _normalise_metadata_to_index_fields(
if isinstance(field, str):
index_field_spec[field] = (field, MetadataIndexFieldType.STRING)
elif hasattr(field, "name"): # SearchField-like object
index_field_spec[field.name] = (
field # Store the actual field object
)
index_field_spec[
field.name
] = field # Store the actual field object

elif isinstance(filterable_metadata_field_keys, dict):
for k, v in filterable_metadata_field_keys.items():
Expand Down Expand Up @@ -434,7 +434,7 @@ def _validate_index_configuration(self, index: Any) -> None:
}

# Check each required field
for field_key, (expected_type, field_config) in required_fields.items():
for expected_type, field_config in required_fields.values():
if isinstance(field_config, str):
# If field_config is a string, just check field existence and type
field = next((f for f in index.fields if f.name == field_config), None)
Expand Down Expand Up @@ -520,15 +520,12 @@ def _create_index(self, index_name: Optional[str]) -> None:
ExhaustiveKnnParameters,
HnswAlgorithmConfiguration,
HnswParameters,
SearchableField,
SearchField,
SearchFieldDataType,
SearchIndex,
SemanticConfiguration,
SemanticField,
SemanticPrioritizedFields,
SemanticSearch,
SimpleField,
VectorSearch,
VectorSearchAlgorithmKind,
VectorSearchAlgorithmMetric,
Expand Down Expand Up @@ -701,15 +698,12 @@ async def _acreate_index(self, index_name: Optional[str]) -> None:
ExhaustiveKnnParameters,
HnswAlgorithmConfiguration,
HnswParameters,
SearchableField,
SearchField,
SearchFieldDataType,
SearchIndex,
SemanticConfiguration,
SemanticField,
SemanticPrioritizedFields,
SemanticSearch,
SimpleField,
VectorSearch,
VectorSearchAlgorithmKind,
VectorSearchAlgorithmMetric,
Expand Down Expand Up @@ -1172,17 +1166,23 @@ def __init__(
id_name = (
id_field_key
if id_field_key and len(id_field_key) > 0
else id_field.name if id_field is not None else "id"
else id_field.name
if id_field is not None
else "id"
)
chunk_name = (
chunk_field_key
if chunk_field_key and len(chunk_field_key) > 0
else chunk_field.name if chunk_field is not None else "chunk"
else chunk_field.name
if chunk_field is not None
else "chunk"
)
embedding_name = (
embedding_field_key
if embedding_field_key and len(embedding_field_key) > 0
else embedding_field.name if embedding_field is not None else "embedding"
else embedding_field.name
if embedding_field is not None
else "embedding"
)
metadata_name = (
metadata_string_field_key
Expand All @@ -1196,7 +1196,9 @@ def __init__(
doc_id_name = (
doc_id_field_key
if doc_id_field_key and len(doc_id_field_key) > 0
else doc_id_field.name if doc_id_field is not None else "doc_id"
else doc_id_field.name
if doc_id_field is not None
else "doc_id"
)

self._field_names = {
Expand Down Expand Up @@ -2164,7 +2166,6 @@ def _create_query_vector(self) -> Optional[List[Any]]:
def _create_query_result(
self, search_query: str, vectors: Optional[List[Any]]
) -> VectorStoreQueryResult:

results = self._search_client.search(
search_text=search_query,
vector_queries=vectors,
Expand Down Expand Up @@ -2261,7 +2262,6 @@ def _create_query_result(
async def _acreate_query_result(
self, search_query: str, vectors: Optional[List[Any]]
) -> VectorStoreQueryResult:

results = await self._async_search_client.search(
search_text=search_query,
vector_queries=vectors,
Expand Down

0 comments on commit 3bb39d8

Please sign in to comment.