Files
semantic-kernel/python/semantic_kernel/memory/null_memory.py
T
Eduard van Valkenburg fa3e32bb16 Python: set line-length for black in sync with Ruff, run black. (#4396)
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
As we are tightening the formatting and linting setups, this was
missing, now the line-length for black and ruff are the same, thereby no
longer running into black issues as often.

### Description

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

### 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 😄
2024-01-04 14:28:20 +00:00

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_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