generative library

Native entrypoint for AI-generated media in Fluvie.

Import this alongside package:fluvie_ai/fluvie_ai.dart on a server, the CLI, or a device to install the generative resolver that produces GenerativeImage / GenerativeVideo / GenerativeMusic (and friends) before a render:

import 'package:fluvie_ai/generative.dart';

final resolver = fluvieGenerativeResolverFor(); // reads provider keys from env

It uses dart:io (the on-disk asset cache), so it is kept out of the web-safe fluvie_ai barrel.

Classes

GenerativeCache
A committable, content-addressed store for produced generative assets.
GenerativeConfig
Configuration for the generative media resolver: provider credentials, the on-disk cacheDir, an offline switch, and an optional maxGenerations budget.
GenerativeMediaResolver
The real GenerativeResolver: produces every declared generative source through ai_abstracted before the frame loop, caches it on disk by prompt + seed + params, and serves the produced file-backed source synchronously.

Functions

defaultGenerativeCacheDir() String
The default on-disk cache root: .fluvie/generative under the working directory, so produced assets live in the project and can be committed.
fluvieGenerativeResolverFor({GenerativeConfig? config, Map<String, String>? env}) → GenerativeResolver
Builds the real GenerativeResolver from an explicit config or the process environment — the one-line wiring a render needs to produce Generative* media.
generateFor(GenerativeSource source, {required ProviderRegistry registry, required ProviderCredentials credentials, Client? httpClient, void onProgress(GenerationProgress progress)?}) Future<GenerationResult>
Calls the ai_abstracted generator that matches source's kind through registry, authenticated with credentials.
providerIdFor(String providerId) → ProviderId
Resolves a GenerativeSource.providerId string to an ai_abstracted ProviderId, throwing a FluvieGenerativeException for an unknown name.

Typedefs

GenerateFn = Future<GenerationResult> Function(GenerativeSource source)
Produces one generative asset, injected so the resolver is testable without a network (tests pass a function returning a canned GenerationResult).