Skip to content

Rag cli local

LocalRAGCLIPack #

Bases: BaseLlamaPack

本地 RAG CLI 包。

Source code in llama_index/packs/rag_cli_local/base.py
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
class LocalRAGCLIPack(BaseLlamaPack):
    """本地 RAG CLI 包。"""

    def __init__(
        self,
        verbose: bool = False,
        persist_dir: Optional[str] = None,
        llm_model_name: str = "mistral",
        embed_model_name: str = "BAAI/bge-m3",
    ) -> None:
        """初始化参数。"""
        self.verbose = verbose
        self.persist_dir = persist_dir or default_ragcli_persist_dir()
        self.llm_model_name = llm_model_name
        self.embed_model_name = embed_model_name
        self.rag_cli = init_local_rag_cli(
            persist_dir=self.persist_dir,
            verbose=self.verbose,
            llm_model_name=self.llm_model_name,
            embed_model_name=self.embed_model_name,
        )

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

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

get_modules #

get_modules() -> Dict[str, Any]

获取模块。

Source code in llama_index/packs/rag_cli_local/base.py
104
105
106
def get_modules(self) -> Dict[str, Any]:
    """获取模块。"""
    return {"rag_cli": self.rag_cli}

run #

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

运行流水线。

Source code in llama_index/packs/rag_cli_local/base.py
108
109
110
def run(self, *args: Any, **kwargs: Any) -> Any:
    """运行流水线。"""
    return self.rag_cli.cli(*args, **kwargs)