`rabbithole_instantiates_parsers`
Hook the available parsers for ingesting files in the declarative memory.
Allows replacing or extending existing supported mime types and related parsers to customize the file ingestion.
📄 Arguments
Section titled “📄 Arguments”| Name | Type | Description |
|---|---|---|
file_handlers |
dict |
A dictionary in which keys are the supported mime types and values are the related parsers. |
cat |
Cat | Cheshire Cat instance, allows you to use the framework components. |
↩️ Return
Section titled “↩️ Return”Type: dict
Edited dictionary of supported mime types and related parsers.
✍ Example
Section titled “✍ Example”from cat.mad_hatter.decorators import hookfrom langchain.document_loaders.parsers.language.language_parser import LanguageParserfrom langchain.document_loaders.parsers.msword import MsWordParser
@hook # default priority = 1def rabbithole_instantiates_parsers(file_handlers, cat): new_handlers = { "text/x-python": LanguageParser(language="python"), "text/javascript": LanguageParser(language="js"), "application/vnd.openxmlformats-officedocument.wordprocessingml.document": MsWordParser(), "application/msword": MsWordParser(), } file_handlers = file_handlers | new_handlers return file_handlers