CreatePresentationFromTemplateWorkflow
What it is
A workflow that generates a new PowerPoint presentation from a .pptx template plus JSON-like slide instructions (duplicate specific template slides, update shapes’ text, and write sources into slide notes). It saves the resulting file to object storage, uploads a public asset to Naas, and registers both the template and generated presentation in a triple store.
Public API
-
CreatePresentationFromTemplateWorkflowConfiguration(WorkflowConfiguration)- Holds dependencies and settings:
triple_store: ITripleStoreServicepowerpoint_configuration: PowerPointIntegrationConfigurationnaas_configuration: NaasIntegrationConfigurationpipeline_configuration: AddPowerPointPresentationPipelineConfigurationdatastore_path: str = "datastore/powerpoint/presentations"workspace_id(defaults fromABIModuleconfiguration)storage_name(defaults fromABIModuleconfiguration)
- Holds dependencies and settings:
-
CreatePresentationFromTemplateWorkflowParameters(WorkflowParameters)- Execution inputs:
presentation_name: str(without extension;.pptxis enforced)slides_data: List[Dict](per-slide instructions)template_path: str(path to.pptxtemplate)
- Execution inputs:
-
CreatePresentationFromTemplateWorkflow(Workflow)create_presentation(parameters) -> Dict[str, Any]- Creates the presentation, saves it, uploads it publicly, and registers metadata in a triple store.
- Returns:
presentation_name(ensured to end with.pptx)storage_path(datastore path where saved)download_url(public asset URL from Naas)presentation_uri(triple store URI if available)template_uri(template triple store URI if available)
as_tools() -> list[BaseTool]- Exposes the workflow as a LangChain
StructuredToolnamedcreate_presentation_from_template.
- Exposes the workflow as a LangChain
as_api(...) -> None- Present but not implemented (returns
Noneand does not register routes).
- Present but not implemented (returns
Configuration/Dependencies
- Integrations used internally
PowerPointIntegration(created frompowerpoint_configuration)- Used to load template, remove slides, duplicate slides, update shapes, and update notes.
NaasIntegration(created fromnaas_configuration)- Used to upload the resulting
.pptxas a public asset and return a URL.
- Used to upload the resulting
- Storage
StorageUtilsinitialized fromABIModule.get_instance().engine.services.object_storage- Saves presentations under
datastore_path.
- Triple store
AddPowerPointPresentationPipelineis run twice:- Once for the template (to get
template_uri) - Once for the generated presentation (includes
download_urlandtemplate_uri)
- Once for the template (to get
Usage
Minimal example (requires valid integration configurations and ABIModule engine context):
from naas_abi_marketplace.applications.powerpoint.workflows.CreatePresentationFromTemplateWorkflow import (
CreatePresentationFromTemplateWorkflow,
CreatePresentationFromTemplateWorkflowConfiguration,
CreatePresentationFromTemplateWorkflowParameters,
)
# You must provide real implementations/configs for these:
from naas_abi_marketplace.applications.powerpoint.integrations.PowerPointIntegration import PowerPointIntegrationConfiguration
from naas_abi_marketplace.applications.naas.integrations.NaasIntegration import NaasIntegrationConfiguration
from naas_abi_marketplace.applications.powerpoint.pipelines.AddPowerPointPresentationPipeline import AddPowerPointPresentationPipelineConfiguration
# triple_store: ITripleStoreService must be provided by your runtime/container.
cfg = CreatePresentationFromTemplateWorkflowConfiguration(
triple_store=triple_store,
powerpoint_configuration=PowerPointIntegrationConfiguration(...),
naas_configuration=NaasIntegrationConfiguration(...),
pipeline_configuration=AddPowerPointPresentationPipelineConfiguration(...),
)
wf = CreatePresentationFromTemplateWorkflow(cfg)
result = wf.create_presentation(
CreatePresentationFromTemplateWorkflowParameters(
presentation_name="my_deck",
template_path="templates/base_template.pptx",
slides_data=[
{
"template_slide_number": 0,
"shapes": [{"shape_id": "Title 1", "text": "New Title"}],
"sources": ["https://example.com/source1"],
}
],
)
)
print(result["download_url"])
Using as a LangChain tool:
tool = CreatePresentationFromTemplateWorkflow(cfg).as_tools()[0]
out = tool.run({
"presentation_name": "my_deck",
"template_path": "templates/base_template.pptx",
"slides_data": [],
})
Caveats
slides_dataitems must includetemplate_slide_number; otherwise that slide is skipped (logged as error).- Shape updates and notes updates are wrapped in
try/except; failures are logged and processing continues. as_api()does not expose any FastAPI routes (no API endpoint is created here).workspace_idandstorage_namedefault fromABIModuleconfiguration; the workflow assumesABIModuleis initialized and provides an object storage service.