Skip to main content

llama-index tools ilovevideoeditor integration

Project description

LlamaIndex Tool: iLoveVideoEditor

This tool allows LlamaIndex agents to render MP4 videos from declarative VideoJSON specifications using the iLoveVideoEditor cloud rendering API.

Features

  • 🎬 Programmatic video rendering: Turn VideoJSON specs into MP4 videos via a single tool call
  • Wait or queue: Poll until the render finishes, or queue and check status later
  • 🤖 Agent-ready: Works directly with LlamaIndex agents via BaseToolSpec
  • 🛡️ Error handling: Graceful error handling with informative messages

Requirements

  • Python >= 3.10
  • llama-index-core >= 0.13.0
  • requests >= 2.31.0
  • An iLoveVideoEditor API key (get one from the dashboard)

Installation

pip install llama-index-tools-ilovevideoeditor

Required Environment Variables

ILOVEVIDEOEDITOR_API_KEY=vf_live_...

Usage

from llama_index.tools.ilovevideoeditor import ILoveVideoEditorTool
from llama_index.core.agent import ReActAgent

# Initialize the tool spec (reads ILOVEVIDEOEDITOR_API_KEY from the environment)
tool_spec = ILoveVideoEditorTool()

# Convert the spec to a list of FunctionTools
tools = tool_spec.to_tool_list()

# Create an agent with the rendering tools
agent = ReActAgent.from_tools(tools, verbose=True)

# The agent can now render videos from VideoJSON specs
agent.chat(
    "Render a 3-second 1080p video with the text 'Hello from LlamaIndex' "
    "using the iLoveVideoEditor tool."
)

Direct usage without an agent:

from llama_index.tools.ilovevideoeditor import ILoveVideoEditorTool

tool = ILoveVideoEditorTool()

result = tool.render_video(
    {
        "name": "hello",
        "layers": [
            {
                "type": "text",
                "settings": {
                    "startTime": 0,
                    "duration": 3,
                    "text": "Hello from LlamaIndex",
                    "fontSize": 64,
                    "color": "#ffffff",
                },
            }
        ],
    }
)
# '{"jobId": "425ba18a-...", "status": "completed", "downloadUrl": "https://..."}'

Queue without waiting, then check status later:

queued = tool.render_video(video_json, wait_for_completion=False)
# '{"jobId": "425ba18a-...", "status": "queued"}'

status = tool.get_render_status("425ba18a-...")
# '{"jobId": "425ba18a-...", "status": "completed", "downloadUrl": "https://..."}'

Configuration options

  • api_key: API key. Defaults to the ILOVEVIDEOEDITOR_API_KEY environment variable.
  • base_url: API base URL. Defaults to the ILOVEVIDEOEDITOR_API_BASE environment variable or https://api.ilovevideoeditor.com.
  • max_wait_seconds: Maximum time to poll for render completion (default 300).
  • poll_interval_seconds: Interval between status polls (default 2).

API reference

For the full VideoJSON schema and REST API reference, see the iLoveVideoEditor API docs.

Examples

See the examples directory for more usage examples.

Development

Run tests:

make test

Run linters:

make lint

Format code:

make format

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

llama_index_tools_ilovevideoeditor-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file llama_index_tools_ilovevideoeditor-0.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_ilovevideoeditor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2384c0471bc3f50ce1a0f54c04d2df70100d8bda34fc5e800e49e3a06a89603f
MD5 0cd9c885666feac5847de184870f5c97
BLAKE2b-256 03d852a873317b4a8e895cd271df9777d6f917716aa97160f8fdef431c469cc2

See more details on using hashes here.

File details

Details for the file llama_index_tools_ilovevideoeditor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_ilovevideoeditor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee83e06b09ca12699a46f8c7e1d303da09d68fae0af7f9d7f7ce993231402c48
MD5 98f5387a6654f77defe5f2ee746e89f5
BLAKE2b-256 ba1295ad769d6c4eec5fec6ce829774af22d48c80a6b567524ecea7c0dbcde1e

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