Skip to content

query_rag_stage

QueryRagStage

Bases: BaseRagStage

Source code in griptape/engines/rag/stages/query_rag_stage.py
@define(kw_only=True)
class QueryRagStage(BaseRagStage):
    query_modules: list[BaseQueryRagModule] = field()

    @property
    def modules(self) -> Sequence[BaseRagModule]:
        return self.query_modules

    def run(self, context: RagContext) -> RagContext:
        logging.info("QueryRagStage: running %s query generation modules sequentially", len(self.query_modules))

        [qm.run(context) for qm in self.query_modules]

        return context

modules: Sequence[BaseRagModule] property

query_modules: list[BaseQueryRagModule] = field() class-attribute instance-attribute

run(context)

Source code in griptape/engines/rag/stages/query_rag_stage.py
def run(self, context: RagContext) -> RagContext:
    logging.info("QueryRagStage: running %s query generation modules sequentially", len(self.query_modules))

    [qm.run(context) for qm in self.query_modules]

    return context