langchain_community.docstore.in_memory.InMemoryDocstore¶

class langchain_community.docstore.in_memory.InMemoryDocstore(_dict: Optional[Dict[str, Document]] = None)[source]¶

Simple in memory docstore in the form of a dict.

Initialize with dict.

Methods

__init__([_dict])

Initialize with dict.

add(texts)

Add texts to in memory dictionary.

delete(ids)

Deleting IDs from in memory dictionary.

search(search)

Search via direct lookup.

Parameters

_dict (Optional[Dict[str, Document]]) –

__init__(_dict: Optional[Dict[str, Document]] = None)[source]¶

Initialize with dict.

Parameters

_dict (Optional[Dict[str, Document]]) –

add(texts: Dict[str, Document]) None[source]¶

Add texts to in memory dictionary.

Parameters

texts (Dict[str, Document]) – dictionary of id -> document.

Returns

None

Return type

None

delete(ids: List) None[source]¶

Deleting IDs from in memory dictionary.

Parameters

ids (List) –

Return type

None

search(search: str) Union[str, Document][source]¶

Search via direct lookup.

Parameters

search (str) – id of a document to search for.

Returns

Document if found, else error message.

Return type

Union[str, Document]

Examples using InMemoryDocstore¶