ai_abstracted 0.3.0 copy "ai_abstracted: ^0.3.0" to clipboard
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 #

  • OllamaTextClient and MistralTextClient now forward TextRequest.image, so vision works on every text provider rather than only Claude and Gemini. Ollama sends bare base64 in its per-message images array; Mistral sends an OpenAI-style image_url content part with a data: URI. Pick a multimodal model — a text-only one rejects the request with AiInvalidRequestException.
  • Behavior change OllamaTextClient now maps TextRequest.maxTokens onto options.num_predict. Ollama previously ran unbounded regardless of the field; generations are now capped at the requested budget (default 4096). Raise maxTokens if 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 concrete AiException subclasses are now final. Extend AiException itself for a custom provider exception; use composition rather than subclassing a value type.
  • BREAKING The transport wraps only Exceptions as transient. An Error (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.
  • RetryPolicy is now an interface 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.
  • @useResult marks 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 (AiException and 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.
1
likes
160
points
157
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Provider-agnostic generative AI: one set of contracts for text, image, video, speech, sound-effect, and music generation across many providers.

Repository (GitHub)
View/report issues
Contributing

Topics

#ai #generative-ai #llm #media #api-client

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

http, meta

More

Packages that depend on ai_abstracted