mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
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 <hw.chase.17@gmail.com>
This commit is contained in:
parent
38f853dfa3
commit
7cd0936b1c
@ -17,7 +17,7 @@ class InMemoryDocstore(Docstore, AddableMixin):
|
|||||||
overlapping = set(texts).intersection(self._dict)
|
overlapping = set(texts).intersection(self._dict)
|
||||||
if overlapping:
|
if overlapping:
|
||||||
raise ValueError(f"Tried to add ids that already exist: {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]:
|
def search(self, search: str) -> Union[str, Document]:
|
||||||
"""Search via direct lookup."""
|
"""Search via direct lookup."""
|
||||||
|
Loading…
Reference in New Issue
Block a user