Package org.machanism.machai.ai.provider


package org.machanism.machai.ai.provider
Defines the provider abstraction layer used by MachAI to integrate with concrete generative AI services.

This package contains the core Genai contract, reusable base implementations, and adapter types that allow the rest of the application to interact with multiple AI backends through a uniform API. Providers encapsulate initialization from application configuration, prompt and instruction collection, optional tool registration, input logging, embedding generation, response execution, usage reporting, and provider-specific client setup.

Core abstractions

  • Genai defines the common provider lifecycle and operations for conversational prompting, embedding generation, tool registration, request execution, usage inspection, input logging, and session cleanup.
  • AbstractAIProvider supplies shared behavior for configurable providers, including configuration handling, request metadata, input logging, timeout management, and safe tool invocation.
  • GenaiAdapter provides a reusable delegating implementation that forwards calls to another Genai instance, making it suitable for adapter and decorator patterns.

Provider families

  • openai: OpenAI Responses API integration for conversational requests, embeddings, function tools, optional built-in tools, and usage tracking.
  • codemie: EPAM CodeMie integration that authenticates against the CodeMie identity platform and delegates requests to compatible downstream provider implementations according to the configured model family.
  • claude: Anthropic Claude integration for Claude-backed request execution and related provider behavior.

Typical usage

Application code typically obtains a concrete implementation from provider management infrastructure, initializes it with configuration, adds optional instructions and prompts, registers any required tools, and then invokes the provider to obtain a response, embeddings, and usage information.