Skip to content

Tables

ChainOfTablePack #

Bases: BaseLlamaPack

链式表格打包。

Source code in llama_index/packs/tables/chain_of_table/base.py
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
class ChainOfTablePack(BaseLlamaPack):
    """链式表格打包。"""

    def __init__(
        self,
        table: pd.DataFrame,
        llm: Optional[LLM] = None,
        verbose: bool = False,
        **kwargs: Any,
    ) -> None:
        """初始化参数。"""
        self.query_engine = ChainOfTableQueryEngine(
            table=table,
            llm=llm,
            verbose=verbose,
            **kwargs,
        )

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

    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/tables/chain_of_table/base.py
730
731
732
733
734
735
736
def get_modules(self) -> Dict[str, Any]:
    """获取模块。"""
    return {
        "query_engine": self.query_engine,
        "llm": self.query_engine.llm,
        "query_prompt": self.query_engine.query_prompt,
    }

run #

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

运行流水线。

Source code in llama_index/packs/tables/chain_of_table/base.py
738
739
740
def run(self, *args: Any, **kwargs: Any) -> Any:
    """运行流水线。"""
    return self.query_engine.query(*args, **kwargs)

MixSelfConsistencyPack #

Bases: BaseLlamaPack

混合自洽包。

Source code in llama_index/packs/tables/mix_self_consistency/base.py
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
class MixSelfConsistencyPack(BaseLlamaPack):
    """混合自洽包。"""

    def __init__(
        self,
        table: pd.DataFrame,
        llm: Optional[LLMType] = None,
        verbose: bool = False,
        normalize_table: bool = False,
        text_paths: int = 2,
        symbolic_paths: int = 2,
        aggregation_mode: AggregationMode = AggregationMode.SELF_CONSISTENCY,
        **kwargs: Any,
    ) -> None:
        self.query_engine = MixSelfConsistencyQueryEngine(
            table=table,
            llm=llm,
            verbose=verbose,
            normalize_table=normalize_table,
            text_paths=text_paths,
            symbolic_paths=symbolic_paths,
            aggregation_mode=aggregation_mode,
            **kwargs,
        )

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

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

get_modules #

get_modules() -> Dict[str, Any]

获取模块。

Source code in llama_index/packs/tables/mix_self_consistency/base.py
424
425
426
427
428
429
def get_modules(self) -> Dict[str, Any]:
    """获取模块。"""
    return {
        "query_engine": self.query_engine,
        "llm": self.query_engine.llm,
    }

run #

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

运行流水线。

Source code in llama_index/packs/tables/mix_self_consistency/base.py
431
432
433
def run(self, *args: Any, **kwargs: Any) -> Any:
    """运行流水线。"""
    self.query_engine.query(*args, **kwargs)