mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 11:19:56 +00:00
### Motivation and Context Delete all *_async where *_sync doesn't exist to make the library more Pythonic. Fixes #4629 ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄 --------- Co-authored-by: Evan Mattson <[email protected]>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
from typing import List, Optional
|
|
|
|
from semantic_kernel.memory.memory_query_result import MemoryQueryResult
|
|
from semantic_kernel.memory.semantic_text_memory_base import SemanticTextMemoryBase
|
|
|
|
|
|
class NullMemory(SemanticTextMemoryBase):
|
|
async def save_information(
|
|
self,
|
|
collection: str,
|
|
text: str,
|
|
id: str,
|
|
description: Optional[str] = None,
|
|
additional_metadata: Optional[str] = None,
|
|
) -> None:
|
|
"""Nullifies behavior of SemanticTextMemoryBase.save_information()"""
|
|
return None
|
|
|
|
async def save_reference(
|
|
self,
|
|
collection: str,
|
|
text: str,
|
|
external_id: str,
|
|
external_source_name: str,
|
|
description: Optional[str] = None,
|
|
additional_metadata: Optional[str] = None,
|
|
) -> None:
|
|
"""Nullifies behavior of SemanticTextMemoryBase.save_reference()"""
|
|
return None
|
|
|
|
async def get(self, collection: str, query: str) -> Optional[MemoryQueryResult]:
|
|
"""Nullifies behavior of SemanticTextMemoryBase.get()"""
|
|
return None
|
|
|
|
async def search(
|
|
self,
|
|
collection: str,
|
|
query: str,
|
|
limit: int = 1,
|
|
min_relevance_score: float = 0.7,
|
|
) -> List[MemoryQueryResult]:
|
|
"""Nullifies behavior of SemanticTextMemoryBase.search()"""
|
|
return []
|
|
|
|
async def get_collections(self) -> List[str]:
|
|
"""Nullifies behavior of SemanticTextMemoryBase.get_collections()"""
|
|
return []
|
|
|
|
|
|
NullMemory.instance = NullMemory() # type: ignore
|