You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am getting the following Keyerror with following trace
File "./documents_store/pipelines.py", line 141, in <module>
pipe = passage_retrieval.pipeline_for_search("creditcards", "query")
File "./documents_store/pipelines.py", line 127, in pipeline_for_search
pipe.add_node(component=emb_retriever, name="MultihopEmbeddingRetriever",
File "/opt/python/virtual_envs/venv_py_392_passage_retrieval/lib/python3.9/site-packages/haystack/pipelines/base.py", line 402, in add_node
component_definitions = get_component_definitions(pipeline_config=self.get_config())
File "/opt/python/virtual_envs/venv_py_392_passage_retrieval/lib/python3.9/site-packages/haystack/pipelines/base.py", line 1815, in get_config
self._add_component_to_definitions(
File "/opt/python/virtual_envs/venv_py_392_passage_retrieval/lib/python3.9/site-packages/haystack/pipelines/base.py", line 1856, in _add_component_to_definitions
self._add_component_to_definitions(sub_component, component_definitions, return_defaults)
File "/opt/python/virtual_envs/venv_py_392_passage_retrieval/lib/python3.9/site-packages/haystack/pipelines/base.py", line 1851, in _add_component_to_definitions
component_params: Dict[str, Any] = component.get_params(return_defaults)
File "/opt/python/virtual_envs/venv_py_392_passage_retrieval/lib/python3.9/site-packages/haystack/nodes/base.py", line 104, in get_params
if value != component_signature[key].default or return_defaults:
KeyError: 'index
Error message
KeyError: 'index'
To Reproduce
I have the following custom code one is eshandler.py
classESHandler(ElasticsearchDocumentStore):
def__init__(self, *args, **kwargs):
logger.info("connecting to elastic search")
try:
super(ESHandler, self).__init__(host=es_host, port=es_port, username=es_username, password=es_password,
index=kwargs.get('index'), similarity='cosine', embedding_dim=768,
)
exceptConnectionErrorasCE:
logger.exception(f"Unable to connect to ES instance, make sure its up, exiting app {CE}")
sys.exit(1)
self.index=kwargs.get('index')
Now I have another file called pipelines.py where the error is getting.
The issue is indeed very tricky. What triggers it is the fact that ESHandler takes variadic arguments (arguments with one or two stars, like *args and **kwargs). By replacing:
This issue arises from the fact that Haystack is able to convert existing pipelines into their YAML definition with Pipeline.save_to_yaml. To do so, it needs to hook into the init process of every node and collect information about their init parameters and values.
The entire mechanism works well until variadic arguments are used, like *args and **kwargs. Those prevent Haystack from understanding which keys and values to set aside in for later use in case save_to_yaml was to be used, which makes the entire system collapse and show obscure errors like the one you observed above.
Describe the bug
I am getting the following Keyerror with following trace
Error message
KeyError: 'index'
To Reproduce
I have the following custom code one is eshandler.py
Now I have another file called pipelines.py where the error is getting.
FAQ Check
System:
The text was updated successfully, but these errors were encountered: