Skip to main content

kiarina-agi-data-builder

English | 日本語

What is this?

kiarina-agi-data-builder provides builders for AI agent messages, events, histories, tool info, file info, and file segments.

Dependencies

Required Dependencies

Package Version License
kiarina-agi-audio >=2.9.0 MIT
kiarina-agi-base >=2.7.0 MIT
kiarina-agi-data >=2.7.0 MIT
kiarina-agi-file >=2.8.0 MIT
kiarina-agi-tool >=2.12.0 MIT
kiarina-agi-video >=2.10.0 MIT
kiarina-i18n >=2.3.1 MIT
kiarina-utils-app >=2.4.0 MIT
kiarina-utils-common >=2.8.0 MIT
kiarina-utils-file >=2.3.1 MIT
Pydantic >=2.11.7,<3 MIT
pydantic-settings >=2.10.1,<3 MIT
pydantic-settings-manager >=3.2.0 MIT
PyYAML >=6.0.2 MIT

Optional Dependencies

Package Extras
imageio-ffmpeg file-info-builder-audio
file-info-builder-video
Pillow file-info-builder-image
file-info-builder-pdf
file-info-builder-video
pypdf file-info-builder-pdf
pypdfium2 file-info-builder-pdf
soundfile file-info-builder-audio

The all Extra installs every optional dependency listed above.

Installation

pip install "kiarina-agi-data-builder[all]"

Features

Capability-aware PDF fallback

PDF analysis bundles select content from chat model capabilities.

Capabilities Content
Text only Extracted PDF text
Image Page-numbered page images and extracted PDF text
PDF The original PDF or selected page segment

Set analysis_dpi on the PDF file specification to control the resolution of fallback page images.

from kiarina.agi.file_info_builder_impl.pdf import create_pdf_file_info_builder
from kiarina.agi.run_context import RunContext
from kiarina.utils.file.asyncio import read_file


async def build_pdf_info():
    file_blob = await read_file("/path/to/document.pdf")
    assert file_blob is not None
    builder = create_pdf_file_info_builder(analysis_enabled=True)
    return await builder.build(
        {
            "uri_or_file_path": file_blob.file_path,
            "analysis_dpi": 144,
        },
        file_blob,
        run_context=RunContext(),
    )

Capability-aware video fallback

Video analysis bundles select content from chat model capabilities.

Capabilities Content
Text only Audio transcript and ambient analysis
Image Timestamped video frames, transcript, and ambient analysis
Video Video with its audio track

Set analysis_fps on the video file specification to control the frame rate of the prepared video and fallback images.

from kiarina.agi.file_info_builder_impl.video import (
    create_video_file_info_builder,
)
from kiarina.agi.run_context import RunContext
from kiarina.utils.file.asyncio import read_file


async def build_video_info():
    file_blob = await read_file("/path/to/video.mp4")
    assert file_blob is not None
    builder = create_video_file_info_builder(
        analysis_enabled=True,
        audio_consumers=["stt", "ambient"],
    )
    return await builder.build(
        {
            "uri_or_file_path": file_blob.file_path,
            "analysis_fps": 1.0,
        },
        file_blob,
        run_context=RunContext(),
    )

API Reference

kiarina.agi.file_info_builder_impl.pdf

from kiarina.agi.file_info_builder_impl.pdf import (
    PDFFileInfoBuilder,
    PDFFileInfoBuilderSettings,
    create_pdf_file_info_builder,
    settings_manager,
)

create_pdf_file_info_builder

def create_pdf_file_info_builder(**kwargs: Any) -> PDFFileInfoBuilder: ...

Creates a PDF file info builder from managed settings and optional overrides.

PDFFileInfoBuilder

class PDFFileInfoBuilder(BaseFileInfoBuilder):
    def __init__(self, settings: PDFFileInfoBuilderSettings) -> None: ...

    async def build(
        self,
        file_info_spec: FileInfoSpec,
        file_blob: FileBlob,
        *,
        run_context: RunContext,
    ) -> BuildResult: ...

PDFFileInfoBuilderSettings

class PDFFileInfoBuilderSettings(BaseSettings):
    analysis_enabled: bool = False

settings_manager is the SettingsManager[PDFFileInfoBuilderSettings] instance used by the factory.

kiarina.agi.file_info_builder_impl.video

from kiarina.agi.file_info_builder_impl.video import (
    VideoFileInfoBuilder,
    VideoFileInfoBuilderSettings,
    create_video_file_info_builder,
    settings_manager,
)

create_video_file_info_builder

def create_video_file_info_builder(**kwargs: Any) -> VideoFileInfoBuilder: ...

Creates a video file info builder from managed settings and optional overrides.

VideoFileInfoBuilder

class VideoFileInfoBuilder(BaseFileInfoBuilder):
    def __init__(self, settings: VideoFileInfoBuilderSettings) -> None: ...

    async def build(
        self,
        file_info_spec: FileInfoSpec,
        file_blob: FileBlob,
        *,
        run_context: RunContext,
    ) -> BuildResult: ...

VideoFileInfoBuilderSettings

class VideoFileInfoBuilderSettings(BaseSettings):
    analysis_enabled: bool = False
    audio_source: AudioSourceSpecifier = "file?sample_rate=16000&start_timestamp=0.0"
    audio_consumers: list[AudioConsumerSpecifier] = [
        "stt?diarization_enabled=true",
        "ambient?window_seconds=10.0&top_k=3",
    ]
    audio_event_bundlers: list[AudioEventBundlerSpecifier] = ["stt", "ambient"]

settings_manager is the SettingsManager[VideoFileInfoBuilderSettings] instance used by the factory.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiarina_agi_data_builder-2.21.1.tar.gz (67.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiarina_agi_data_builder-2.21.1-py3-none-any.whl (100.5 kB view details)

Uploaded Python 3

File details

Details for the file kiarina_agi_data_builder-2.21.1.tar.gz.

File metadata

File hashes

Hashes for kiarina_agi_data_builder-2.21.1.tar.gz
Algorithm Hash digest
SHA256 30b2d2357a65a5113cc59e27530fa8a3e53a14cf290b9ced3a8dafd5b68bea84
MD5 9ddb52938c585791e418ab946fcb970f
BLAKE2b-256 06b25481107f6eea618e6ee6d2d6f1b91c99e007a85571e01731effd593587b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiarina_agi_data_builder-2.21.1.tar.gz:

Publisher: release-pypi.yml on kiarina/kiarina-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kiarina_agi_data_builder-2.21.1-py3-none-any.whl.

File metadata

File hashes

Hashes for kiarina_agi_data_builder-2.21.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90b51fa7ad150d8c7cff8cab5cf3c6c23296e2c0d48a8ec3857cd9455664bdef
MD5 96ddbcdbf285efe4b0883e6b74c560d7
BLAKE2b-256 ea37bb6f2f52d5422f45cf2d69bf189afd09c02a306649b752683316787406c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiarina_agi_data_builder-2.21.1-py3-none-any.whl:

Publisher: release-pypi.yml on kiarina/kiarina-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.21.1 This release

2 files

2.19.0

2 files

2.15.0

2 files

2.13.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page