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 platforms through a consistent application-facing API.

This package contains the core contracts and shared infrastructure for AI providers, including request initialization, prompt and instruction handling, tool registration, embedding generation, usage tracking, input logging, and working-directory propagation. It establishes the common behavior that allows higher-level application code to interact with different model vendors without depending on provider-specific SDK details.

Core contracts and support types

  • Genai defines the primary lifecycle and execution contract for conversational and tool-enabled AI providers.
  • EmbeddingProvider defines the contract for providers that can generate embedding vectors for semantic and similarity-based workflows.
  • AbstractAIProvider supplies reusable base behavior for configuration-driven providers, including timeout handling, request logging, optional web-search support, MCP server registration, and guarded tool invocation.
  • GenaiAdapter provides a delegating implementation that enables wrapper, adapter, and decorator patterns around a concrete Genai instance.

Included provider families

  • openai contains the OpenAI-backed implementation responsible for text generation, iterative function-tool execution, optional web-search and MCP integration, and embedding requests through OpenAI-compatible APIs.
  • codemie contains the CodeMie integration that acquires access tokens, resolves supported hosted model families, and delegates requests to the appropriate provider implementation.
  • claude contains the Anthropic Claude integration that applies the shared provider model to Claude-backed requests.

Typical usage

Application code typically resolves a concrete provider, initializes it with runtime configuration and a model identifier, optionally adds instructions, prompts, tools, and file context, and then invokes the common API to perform generation or embedding operations while reading usage data from the resulting provider instance.

  • Class
    Description
    Base implementation of the Genai contract shared by concrete provider integrations.
    EmbeddingProvider defines the contract for AI embedding providers.
    Contract for a generative-AI provider integration.
    Delegating Genai implementation.
    Utility class for converting between Java types and their string representations, as well as mapping Java types to simplified type names (e.g., "string", "integer", "array").