🐛 fix(loading.py): ensure metadata values are not None for Chroma class
The docstring for the CombineDocsChain class has been updated to reflect the correct function name. In the loading.py file, the instantiate_vectorstore function has been updated to ensure that metadata values are not None for the Chroma class. This is because Chroma requires all metadata values to not be None, and this fix ensures that the application will not encounter errors when using Chroma.
🐛 fix(custom.py): update docstring to reflect the correct function name
This commit is contained in:
parent
144f2b470e
commit
09d4c89136
2 changed files with 10 additions and 1 deletions
|
|
@ -97,7 +97,7 @@ class TimeTravelGuideChain(BaseCustomConversationChain):
|
|||
|
||||
|
||||
class CombineDocsChain(CustomChain):
|
||||
"""Implementation of AgentInitializer function"""
|
||||
"""Implementation of load_qa_chain function"""
|
||||
|
||||
@staticmethod
|
||||
def function_name():
|
||||
|
|
|
|||
|
|
@ -151,6 +151,15 @@ def instantiate_vectorstore(class_object, params):
|
|||
"The source you provided did not load correctly or was empty."
|
||||
"This may cause an error in the vectorstore."
|
||||
)
|
||||
|
||||
# Chroma requires all metadata values to not be None
|
||||
if class_object.__name__ == "Chroma":
|
||||
for doc in params["documents"]:
|
||||
if doc.metadata is None:
|
||||
doc.metadata = {}
|
||||
for key, value in doc.metadata.items():
|
||||
if value is None:
|
||||
doc.metadata[key] = ""
|
||||
return class_object.from_documents(**params)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue