ai_abstracted 0.3.0
ai_abstracted: ^0.3.0 copied to clipboard
Provider-agnostic generative AI: one set of contracts for text, image, video, speech, sound-effect, and music generation across many providers.
Changelog #
0.3.0 #
OllamaTextClientandMistralTextClientnow forwardTextRequest.image, so vision works on every text provider rather than only Claude and Gemini. Ollama sends bare base64 in its per-messageimagesarray; Mistral sends an OpenAI-styleimage_urlcontent part with adata:URI. Pick a multimodal model — a text-only one rejects the request withAiInvalidRequestException.- Behavior change
OllamaTextClientnow mapsTextRequest.maxTokensontooptions.num_predict. Ollama previously ran unbounded regardless of the field; generations are now capped at the requested budget (default 4096). RaisemaxTokensif you relied on the old unbounded behavior. - A Mistral request without an image keeps its content a plain string rather than a single-element parts array, so text-only models are unaffected.
0.2.0 #
A standards-alignment release. One behavior change (Errors no longer retry) and a few type-modifier changes; the rest is documentation, tests, and packaging.
- BREAKING The value types (
GenerationResult,GenerationMetadata,GenerationProgress,ProviderCredentials) and the concreteAiExceptionsubclasses are nowfinal. ExtendAiExceptionitself for a custom provider exception; use composition rather than subclassing a value type. - BREAKING The transport wraps only
Exceptions as transient. AnError(a programming bug) now propagates with its stack trace instead of being retried as a transport failure. - Added
ProviderCredentials.keyless()for keyless providers such as Ollama, so a missing key stays a loud error on the default constructor. RetryPolicyis now aninterface class: implement it to supply a custom backoff curve.- The in-memory fakes are open for extension, so a test can override one method.
- The capability methods now document the exceptions they throw, and the library documentation links the key types.
@useResultmarks the pure builders (RetryPolicy.delayFor,retryableStatus,credentialsFromEnv,allCredentialsFromEnv).
0.1.0 #
First public release.
- Provider-agnostic contracts for text, image, video, speech, sound-effect, and
music generation, each a single async method that takes a typed request and
returns a
GenerationResult(bytes plus normalized metadata). - A shared HTTP transport with exponential backoff, jittered retries, and async-job polling for the providers that run long jobs.
- Typed error hierarchy (
AiExceptionand friends) that maps HTTP status codes to auth, rate-limit, invalid-request, transient, and timeout failures. - Clients for Google Gemini (text and image), Google Veo (video, with Veo 3 audio), OpenAI (image), Black Forest Labs FLUX (image), ElevenLabs (speech and sound effects), Suno (music), Anthropic Claude (text), Mistral (text), and Ollama (local text).
- Multi-turn conversations (
TextRequest.history) and an optional image on the current turn (TextRequest.image) for vision-capable text models. - An environment credential loader, a provider registry, and an in-memory fake for every capability so downstream code stays testable without a network.