-
Notifications
You must be signed in to change notification settings - Fork 3k
/
null_memory.py
54 lines (44 loc) · 1.65 KB
/
null_memory.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# 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
from semantic_kernel.utils.experimental_decorator import experimental_class
@experimental_class
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