Files
semantic-kernel/python/semantic_kernel/memory/null_memory.py
T
SnehaandAbby Harrison e68730119e Python: documentation for /memory (#2176)
### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

Added documentation for files in `python/semantic-kernel/memory` that
were missing them, worded mostly the exact as in .NET

Closes #2141 

### 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: Abby Harrison <[email protected]>
2023-07-27 20:03:54 +00:00

55 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_async(
self,
collection: str,
text: str,
id: str,
description: Optional[str] = None,
additional_metadata: Optional[str] = None,
) -> None:
"""Nullifies behavior of SemanticTextMemoryBase.save_information_async()"""
return None
async def save_reference_async(
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_async()"""
return None
async def get_async(
self, collection: str, query: str
) -> Optional[MemoryQueryResult]:
"""Nullifies behavior of SemanticTextMemoryBase.get_async()"""
return None
async def search_async(
self,
collection: str,
query: str,
limit: int = 1,
min_relevance_score: float = 0.7,
) -> List[MemoryQueryResult]:
"""Nullifies behavior of SemanticTextMemoryBase.search_async()"""
return []
async def get_collections_async(self) -> List[str]:
"""Nullifies behavior of SemanticTextMemoryBase.get_collections_async()"""
return []
NullMemory.instance = NullMemory() # type: ignore