jimeng

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package jimeng implements engine.Engine for the Jimeng (即梦) API by ByteDance.

Image generation is synchronous: POST /v1/images/generations returns URLs directly. Video generation is async: POST /v1/video/generations creates a task, then GET /v1/video/generations/{id} polls for completion. Auth: Authorization: Bearer {key}, env JIMENG_API_KEY.

Index

Constants

View Source
const (
	ModelJimeng21    = "jimeng-2.1"
	ModelJimeng20Pro = "jimeng-2.0-pro"
)

Model constants.

Variables

View Source
var ErrMissingPrompt = fmt.Errorf("jimeng: missing prompt in workflow graph")

Functions

func ConfigSchema

func ConfigSchema() []engine.ConfigField

ConfigSchema returns the configuration fields required by the Jimeng engine.

func DefaultProvider added in v0.15.0

func DefaultProvider() engine.Provider

DefaultProvider returns preset engine configurations for jimeng.

func ModelInfos added in v0.16.0

func ModelInfos() []engine.ModelInfo

ModelInfos returns i18n metadata for all Jimeng models.

func ModelsByCapability

func ModelsByCapability() map[string][]string

ModelsByCapability returns all known Jimeng models grouped by capability.

Types

type Config

type Config struct {
	APIKey            string
	BaseURL           string
	Model             string
	Endpoint          string // override path, e.g. "/v1/images/generations"
	HTTPClient        *http.Client
	WaitForCompletion bool
	PollInterval      time.Duration
	OnProgress        epoll.OnProgress
}

Config configures the Jimeng engine.

type Engine

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

Engine implements engine.Engine for Jimeng.

func New

func New(cfg Config) *Engine

New creates a Jimeng engine instance.

func (*Engine) Capabilities

func (e *Engine) Capabilities() engine.Capability

Capabilities implements engine.Describer.

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, g workflow.Graph) (engine.Result, error)

Execute generates an image or video via the Jimeng API.

func (*Engine) Resume

func (e *Engine) Resume(ctx context.Context, remoteID string) (engine.Result, error)

Resume implements engine.Resumer -- resumes polling a previously submitted video task.

Jump to

Keyboard shortcuts

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