airflow.providers.common.ai.utils.file_analysis

Helpers for building file-analysis prompts for LLM operators.

Attributes

SUPPORTED_FILE_FORMATS

log

Classes

FileAnalysisRequest

Prepared prompt content and discovery metadata for the file-analysis operator.

Functions

build_file_analysis_request(*, file_path, ...)

Resolve files, normalize supported formats, and build prompt content for an LLM run.

detect_file_format(path)

Detect the logical file format and compression codec from a path suffix.

Module Contents

airflow.providers.common.ai.utils.file_analysis.SUPPORTED_FILE_FORMATS: tuple[str, Ellipsis] = ('avro', 'csv', 'jpeg', 'jpg', 'json', 'log', 'parquet', 'pdf', 'png')[source]
airflow.providers.common.ai.utils.file_analysis.log[source]
class airflow.providers.common.ai.utils.file_analysis.FileAnalysisRequest[source]

Prepared prompt content and discovery metadata for the file-analysis operator.

user_content: str | collections.abc.Sequence[pydantic_ai.messages.UserContent][source]
resolved_paths: list[str][source]
total_size_bytes: int[source]
omitted_files: int = 0[source]
text_truncated: bool = False[source]
attachment_count: int = 0[source]
text_file_count: int = 0[source]
airflow.providers.common.ai.utils.file_analysis.build_file_analysis_request(*, file_path, file_conn_id, prompt, multi_modal, max_files, max_file_size_bytes, max_total_size_bytes, max_text_chars, sample_rows)[source]

Resolve files, normalize supported formats, and build prompt content for an LLM run.

airflow.providers.common.ai.utils.file_analysis.detect_file_format(path)[source]

Detect the logical file format and compression codec from a path suffix.

Was this entry helpful?