I need to customize a SelfQueryRetriever(the reason is: the generated target queries in OpenSearch are being generated incorrrectly so we need to tune prompts + we need to add some custom behavior such as multi-tenancy) but we don't want to re-write the whole chain, just the parts what we need to customize. How can we customize specific steps of a chain, is there a way to modify it by position, let's say something like this (pseudo-code):
retriever = SelfQueryRetriever(**config)
retriever[2] = create_custom_module1()
retriever[4] = create_custom_module2()
In this example we preserve the majority of the chain but customize only the third and fifth elements.
Is it possible to do?