Skip to content

Self rag

SelfRAGPack #

Bases: BaseLlamaPack

简单的自我情绪评估工具包。

Source code in llama_index/packs/self_rag/base.py
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
class SelfRAGPack(BaseLlamaPack):
    """简单的自我情绪评估工具包。"""

    def __init__(
        self,
        model_path: str,
        retriever: BaseRetriever,
        verbose: bool = False,
        **kwargs: Any,
    ) -> None:
        """初始化参数。"""
        self.query_engine = SelfRAGQueryEngine(model_path, retriever, verbose)

    def get_modules(self) -> Dict[str, Any]:
        """获取模块。"""
        return {
            "query_engine": self.query_engine,
            "llm": self.query_engine.llm,
            "retriever": self.query_engine.retriever,
        }

    def run(self, *args: Any, **kwargs: Any) -> Any:
        """运行流水线。"""
        return self.query_engine.query(*args, **kwargs)

get_modules #

get_modules() -> Dict[str, Any]

获取模块。

Source code in llama_index/packs/self_rag/base.py
299
300
301
302
303
304
305
def get_modules(self) -> Dict[str, Any]:
    """获取模块。"""
    return {
        "query_engine": self.query_engine,
        "llm": self.query_engine.llm,
        "retriever": self.query_engine.retriever,
    }

run #

run(*args: Any, **kwargs: Any) -> Any

运行流水线。

Source code in llama_index/packs/self_rag/base.py
307
308
309
def run(self, *args: Any, **kwargs: Any) -> Any:
    """运行流水线。"""
    return self.query_engine.query(*args, **kwargs)