Replies: 1 comment
-
To implement a pipeline querying process within the class RecursiveRetrieverSmallToBigPack(BaseLlamaPack):
def query_pipeline(self, initial_query: str, operations: List[Callable[[Any], Any]]) -> Any:
"""
Execute a pipeline of query operations on the result of an initial query.
:param initial_query: The initial query string to be executed.
:param operations: A list of functions that take a query result and return a modified result.
:return: The final result after all operations have been applied.
"""
# Execute the initial query
result = self.query_engine.query(initial_query)
# Sequentially apply each operation in the pipeline to the result
for operation in operations:
result = operation(result)
return result In this setup, To use this method, you would define your query operations as functions or lambdas that can be passed to
|
Beta Was this translation helpful? Give feedback.
-
Apologies for the basic question as I am new to llama_index. Our research has shown the impressive capabilities of llama_index in the 'pipeline' for handling complex tasks. The potential of llama_index has truly surprised me.
However, my current query takes a different direction. Upon exploring the 'RecursiveRetriever in our RetrieverQueryEngine', I noticed its effectiveness in retrieval, particularly with structured data processing like vectoring and querying using query_engine_query is great.
My question now is whether it is feasible to implement a pipeline process similar to the one used in the 'Pandas query pipeline' within the RecursiveRetriever of our RetrieverQueryEngine?
I aim to transition from using query_engine.query, as demonstrated in the documentation, to a pipeline approach similar to this example:
response = qp.run(query_str="What is the correlation between survival and age?")
.Your guidance on this matter would be greatly appreciated.
These are the references I am using for LlamaIndex
Recursive Retriever + Query Engine Demo https://docs.llamaindex.ai/en/stable/examples/query_engine/pdf_tables/recursive_retriever/
Pandas query pipe line: https://docs.llamaindex.ai/en/stable/examples/pipeline/query_pipeline_pandas/?h=pandas+query
Beta Was this translation helpful? Give feedback.
All reactions