Skip to content

response_rag_stage

ResponseRagStage

Bases: BaseRagStage

Source code in griptape/engines/rag/stages/response_rag_stage.py
@define(kw_only=True)
class ResponseRagStage(BaseRagStage):
    response_modules: list[BaseResponseRagModule] = field()

    @property
    def modules(self) -> list[BaseRagModule]:
        ms = []

        ms.extend(self.response_modules)

        return ms

    def run(self, context: RagContext) -> RagContext:
        logging.info("ResponseRagStage: running %s retrieval modules in parallel", len(self.response_modules))

        results = utils.execute_futures_list(
            [self.futures_executor.submit(r.run, context) for r in self.response_modules]
        )

        context.outputs = results

        return context

modules: list[BaseRagModule] property

response_modules: list[BaseResponseRagModule] = field() class-attribute instance-attribute

run(context)

Source code in griptape/engines/rag/stages/response_rag_stage.py
def run(self, context: RagContext) -> RagContext:
    logging.info("ResponseRagStage: running %s retrieval modules in parallel", len(self.response_modules))

    results = utils.execute_futures_list(
        [self.futures_executor.submit(r.run, context) for r in self.response_modules]
    )

    context.outputs = results

    return context