Skip to content

Tables

ChainOfTablePack #

Bases: BaseLlamaPack

Chain of table pack.

Source code in llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py
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
741
class ChainOfTablePack(BaseLlamaPack):
    """Chain of table pack."""

    def __init__(
        self,
        table: pd.DataFrame,
        llm: Optional[LLM] = None,
        verbose: bool = False,
        **kwargs: Any,
    ) -> None:
        """Init params."""
        self.query_engine = ChainOfTableQueryEngine(
            table=table,
            llm=llm,
            verbose=verbose,
            **kwargs,
        )

    def get_modules(self) -> Dict[str, Any]:
        """Get modules."""
        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:
        """Run the pipeline."""
        return self.query_engine.query(*args, **kwargs)

get_modules #

get_modules() -> Dict[str, Any]

Get modules.

Source code in llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py
731
732
733
734
735
736
737
def get_modules(self) -> Dict[str, Any]:
    """Get modules."""
    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

Run the pipeline.

Source code in llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py
739
740
741
def run(self, *args: Any, **kwargs: Any) -> Any:
    """Run the pipeline."""
    return self.query_engine.query(*args, **kwargs)

MixSelfConsistencyPack #

Bases: BaseLlamaPack

Mix Self Consistency Pack.

Source code in llama-index-packs/llama-index-packs-tables/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):
    """Mix Self Consistency Pack."""

    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]:
        """Get modules."""
        return {
            "query_engine": self.query_engine,
            "llm": self.query_engine.llm,
        }

    def run(self, *args: Any, **kwargs: Any) -> Any:
        """Run the pipeline."""
        self.query_engine.query(*args, **kwargs)

get_modules #

get_modules() -> Dict[str, Any]

Get modules.

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

run #

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

Run the pipeline.

Source code in llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/mix_self_consistency/base.py
431
432
433
def run(self, *args: Any, **kwargs: Any) -> Any:
    """Run the pipeline."""
    self.query_engine.query(*args, **kwargs)