videogen

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package videogen implements the video-generation agent behind the generate_video tool. Jobs run asynchronously upstream (submit → poll → download); Generate blocks until the clip is ready, fails, or the configured timeout trips.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent drives the asynchronous video endpoint.

func New

func New(client llm.Client, cfg *config.VideoGeneratorConfig, logger *slog.Logger) *Agent

New constructs a video-generation Agent.

func (*Agent) Generate

func (a *Agent) Generate(ctx context.Context, req Request) (resp *Response, err error)

Generate submits a job, polls until it finishes and downloads the clip.

type Failure

type Failure struct {
	Kind  FailureKind
	Text  string // provider reason for KindJobFailed
	Cause error
}

Failure is the typed error Generate returns when no clip was produced.

func (*Failure) Error

func (f *Failure) Error() string

func (*Failure) Unwrap

func (f *Failure) Unwrap() error

type FailureKind

type FailureKind int

FailureKind classifies why a video job produced no clip.

const (
	KindUnknown FailureKind = iota
	// KindTimeout — the job did not finish within the configured timeout.
	KindTimeout
	// KindUpstreamError — network failure or provider API error.
	KindUpstreamError
	// KindSafetyBlock — the submit was rejected by a content policy.
	KindSafetyBlock
	// KindJobFailed — the job ran and ended failed/cancelled/expired; Text
	// carries the provider's reason when it gave one.
	KindJobFailed
)

func (FailureKind) String

func (k FailureKind) String() string

String returns the stable span/log identifier.

type Request

type Request struct {
	UserID storage.ScopeID
	Prompt string
	// AspectRatio and Duration fall back to the config defaults when empty/0.
	AspectRatio string
	Duration    int
	// Audio overrides the configured generate_audio default when non-nil.
	Audio *bool
	// FirstFrame / LastFrame are optional input images (data URLs).
	FirstFrame *llm.FilePart
	LastFrame  *llm.FilePart
}

Request describes one clip.

type Response

type Response struct {
	Data     []byte
	MimeType string
	JobID    string
	Cost     *float64
	Duration time.Duration // wall time of the whole job
}

Response is a finished clip.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL