Package org.machanism.machai.ai.manager


package org.machanism.machai.ai.manager
Provides management utilities and data structures for working with generative AI providers and their token-usage metrics.

This package contains the provider manager responsible for resolving and instantiating chat and embedding providers from model identifiers, together with lightweight usage records and an in-memory statistics registry. Provider implementations are loaded dynamically by GenaiProviderManager using configured model strings such as OpenAI:gpt-4o or OpenAI:text-embedding-3-small.

Token usage reported by providers can be represented with Usage and aggregated through UsageStatistics. This allows callers to record prompt, cached prompt, and completion token counts per model and to log summarized usage information for operational visibility.

Typical responsibilities covered by this package include:

  • Resolving provider implementation classes from provider/model strings.
  • Initializing chat and embedding provider instances with application configuration.
  • Capturing immutable token-usage values for individual AI interactions.
  • Aggregating and logging usage totals grouped by model identifier.
  • Classes
    Class
    Description
    Utility class for dynamically loading and initializing generative AI providers and embedding providers.
    Immutable token-usage metrics for a single generative AI interaction.
    Central registry for aggregated GenAI token-usage statistics.