Skip to main content

Assembler components for the Sayou Data Platform

Project description

sayou-assembler

PyPI version License Docs

Overview

The Knowledge Builder for Sayou Fabric.

sayou-assembler acts as the structural engineer of the pipeline. It accepts flat lists of SayouNode objects produced by the Wrapper and constructs meaningful relationships (Edges), embeddings, or specific query payloads.

While the Wrapper focuses on what the data is (Schema), the Assembler focuses on how the data connects (Topology).


1. Architecture & Role

The Assembler takes standardized Nodes and applies a Building Strategy to generate a connected graph structure or vector payloads ready for loading.

graph LR
    Nodes[Flat SayouNodes] --> Pipeline[Assembler Pipeline]
    
    subgraph Builders
        Graph[General Graph]
        Code[Python AST]
        Time[Timeline]
        Vector[Embeddings]
        Cypher[Cypher Query]
    end
    
    Pipeline -->|Config Routing| Builders
    Builders --> Payload[Connected Payload]

1.1. Core Features

  • Topology Construction: Automatically links nodes (e.g., Parent-Child, Function-Class) based on metadata.
  • Domain Specificity: Dedicated builders for Python code analysis and Video timelines.
  • Bi-directional Linking: Automatically generates reverse edges (e.g., contains <-> belongsTo) to ensure graph traversability.

2. Available Strategies

sayou-assembler provides specialized builders for different data domains.

Strategy Key Builder Class Description
graph GraphBuilder [Default] Generic builder. Links nodes based on parent_id and generic relationships.
code CodeGraphBuilder [Code] Parses Python AST metadata to link Imports, Classes, and Methods.
timeline TimelineBuilder [Media] Sequences video segments or logs chronologically (NEXT, PREV).
vector VectorBuilder [Search] Converts node content into vector embeddings.
cypher CypherBuilder [DB] Generates Neo4j MERGE statements for idempotent inserts.

3. Installation

pip install sayou-assembler

4. Usage

The AssemblerPipeline is the entry point. It transforms SayouOutput (from Wrapper) into a dictionary containing nodes and edges.

Case A: General Graph Construction

The default strategy for general documents (PDF, Markdown).

from sayou.assembler import AssemblerPipeline

wrapper_output = {
    "nodes": [
        {"node_id": "doc:1", "node_class": "sayou:Document", "attributes": {...}},
        {"node_id": "doc:1:header", "attributes": {"meta:parent_id": "doc:1"}, ...}
    ]
}

graph_data = AssemblerPipeline.process(data=wrapper_output)

print(f"Nodes: {len(graph_data['nodes'])}, Edges: {len(graph_data['edges'])}")

Case B: Python Code Graph

Links functions to classes and resolves import dependencies.

from sayou.assembler import AssemblerPipeline

wrapper_output = {
    "nodes": [
        {"node_id": "doc:1", "node_class": "sayou:Document", "attributes": {...}},
        {"node_id": "doc:1:header", "attributes": {"meta:parent_id": "doc:1"}, ...}
    ]
}

code_graph = AssemblerPipeline.process(data=wrapper_output)

print(f"Dependency Edges: {len(code_graph['edges'])}")

Case C: Multimedia Timeline

Sequences video segments by time.

from sayou.assembler import AssemblerPipeline

wrapper_output = {
    "nodes": [
        {"node_id": "doc:1", "node_class": "sayou:Document", "attributes": {...}},
        {"node_id": "doc:1:header", "attributes": {"meta:parent_id": "doc:1"}, ...}
    ]
}

timeline_graph = AssemblerPipeline.process(data=wrapper_output)
print(f"Timeline Sequence Created.")

5. Configuration Keys

You can customize the building process via the config dictionary.

  • graph: create_reverse_edges (bool), default_edge_label.
  • python: resolve_imports (bool), include_external_libs (bool).
  • timeline: interval_threshold (float).
  • vector: embedding_model (e.g., openai, huggingface), batch_size.
  • cypher: merge_mode (bool), batch_size.

6. License

Apache 2.0 License © 2026 Sayouzone

Project details


Download files

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

Source Distribution

sayou_assembler-0.4.2.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

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

sayou_assembler-0.4.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file sayou_assembler-0.4.2.tar.gz.

File metadata

  • Download URL: sayou_assembler-0.4.2.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sayou_assembler-0.4.2.tar.gz
Algorithm Hash digest
SHA256 f2b0dbf46e033ce85a523003846596de5d0721314890b1b8c66eebd7e50a8a0a
MD5 e94dd448b0cb9154617e3749ba6fd090
BLAKE2b-256 0ba05a865145c7896783dbb98db40e8ef2df9750b0e2acd4c4379a97c59814f9

See more details on using hashes here.

File details

Details for the file sayou_assembler-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sayou_assembler-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca74bf2e7a43e69610da92ea4420df9d83d8916790e1c923ce3304ab20e07f5
MD5 6adf05118f31f3153274b700d9fbed3e
BLAKE2b-256 3f9e5497a00ac6182e57cab1a026a258dad0446a027deae6cf1a30485076e1bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page