engines
__all__ = ['BaseSummaryEngine', 'PromptSummaryEngine', 'BaseExtractionEngine', 'CsvExtractionEngine', 'JsonExtractionEngine', 'RagEngine']
module-attribute
BaseExtractionEngine
Bases: ABC
Source code in griptape/engines/extraction/base_extraction_engine.py
chunk_joiner: str = field(default='\n\n', kw_only=True)
class-attribute
instance-attribute
chunker: BaseChunker = field(default=Factory(lambda self: TextChunker(tokenizer=self.prompt_driver.tokenizer, max_tokens=self.max_chunker_tokens), takes_self=True), kw_only=True)
class-attribute
instance-attribute
max_chunker_tokens: int
property
max_token_multiplier: float = field(default=0.5, kw_only=True)
class-attribute
instance-attribute
min_response_tokens: int
property
prompt_driver: BasePromptDriver = field(default=Factory(lambda: Defaults.drivers_config.prompt_driver), kw_only=True)
class-attribute
instance-attribute
extract_artifacts(artifacts, *, rulesets=None, **kwargs)
abstractmethod
extract_text(text, *, rulesets=None, **kwargs)
validate_max_token_multiplier(_, max_token_multiplier)
Source code in griptape/engines/extraction/base_extraction_engine.py
BaseSummaryEngine
Bases: ABC
Source code in griptape/engines/summary/base_summary_engine.py
summarize_artifacts(artifacts, *, rulesets=None)
abstractmethod
CsvExtractionEngine
Bases: BaseExtractionEngine
Source code in griptape/engines/extraction/csv_extraction_engine.py
column_names: list[str] = field(kw_only=True)
class-attribute
instance-attribute
format_header: Callable[[list[str]], str] = field(default=lambda value: ','.join(value), kw_only=True)
class-attribute
instance-attribute
format_row: Callable[[dict], str] = field(default=lambda value: ','.join(value.values()), kw_only=True)
class-attribute
instance-attribute
generate_system_template: J2 = field(default=Factory(lambda: J2('engines/extraction/csv/system.j2')), kw_only=True)
class-attribute
instance-attribute
generate_user_template: J2 = field(default=Factory(lambda: J2('engines/extraction/csv/user.j2')), kw_only=True)
class-attribute
instance-attribute
extract_artifacts(artifacts, *, rulesets=None, **kwargs)
Source code in griptape/engines/extraction/csv_extraction_engine.py
text_to_csv_rows(text)
JsonExtractionEngine
Bases: BaseExtractionEngine
Source code in griptape/engines/extraction/json_extraction_engine.py
JSON_PATTERN = '(?s)[^\\[]*(\\[.*\\])'
class-attribute
instance-attribute
generate_system_template: J2 = field(default=Factory(lambda: J2('engines/extraction/json/system.j2')), kw_only=True)
class-attribute
instance-attribute
generate_user_template: J2 = field(default=Factory(lambda: J2('engines/extraction/json/user.j2')), kw_only=True)
class-attribute
instance-attribute
template_schema: dict = field(kw_only=True)
class-attribute
instance-attribute
extract_artifacts(artifacts, *, rulesets=None, **kwargs)
Source code in griptape/engines/extraction/json_extraction_engine.py
json_to_text_artifacts(json_input)
Source code in griptape/engines/extraction/json_extraction_engine.py
PromptSummaryEngine
Bases: BaseSummaryEngine