From 7cd0936b1ca3f926dd58b231c81713c4e3d25791 Mon Sep 17 00:00:00 2001 From: Paul Cook Date: Wed, 5 Jul 2023 18:48:38 +0200 Subject: [PATCH] Update in_memory.py to fix "TypeError: keywords must be strings" (#7202) Update in_memory.py to fix "TypeError: keywords must be strings" on certain dictionaries Simple fix to prevent a "TypeError: keywords must be strings" error I encountered in my use case. @baskaryan Thanks! Hope useful! --------- Co-authored-by: Harrison Chase --- langchain/docstore/in_memory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/docstore/in_memory.py b/langchain/docstore/in_memory.py index f1e36102581..1049337839b 100644 --- a/langchain/docstore/in_memory.py +++ b/langchain/docstore/in_memory.py @@ -17,7 +17,7 @@ class InMemoryDocstore(Docstore, AddableMixin): overlapping = set(texts).intersection(self._dict) if overlapping: raise ValueError(f"Tried to add ids that already exist: {overlapping}") - self._dict = dict(self._dict, **texts) + self._dict = {**self._dict, **texts} def search(self, search: str) -> Union[str, Document]: """Search via direct lookup."""