Package org.machanism.machai.ai.provider.impl


package org.machanism.machai.ai.provider.impl
Provides concrete implementations of the Machai generative AI provider abstraction.

This package contains provider adapters that connect Machai's common AI interfaces to specific runtime backends and tool execution strategies. The implementations translate prompts, instructions, tool definitions, web-search configuration, MCP server configuration, embedding requests, and usage accounting between Machai's internal provider model and the corresponding external API or local execution mechanism.

Included providers

  • OpenAIProvider adapts the OpenAI Java SDK Responses API and embedding API. It supports conversational prompting, function tools, MCP tools, web search, usage tracking, and embedding generation for OpenAI-compatible endpoints.
  • AnthropicProvider adapts the Anthropic Java SDK Beta Messages API. It supports message construction, local function tools, optional web search, MCP server forwarding, prompt-cache control for large tool results, and usage tracking.
  • CodeMieProvider integrates with EPAM CodeMie authentication, obtains OAuth 2.0 access tokens, and delegates requests to an OpenAI-compatible or Anthropic-compatible provider based on the configured model family.
  • ToolsProvider executes locally registered function tools directly from structured YAML prompts, which is useful for tool-only workflows and deterministic host-side execution.

Typical usage

Applications normally create a provider through the higher-level Machai provider factory or adapter APIs, initialize it with a model name and Configurator, add any required prompts or tools, and call perform() to execute the request. Providers may be reused after calling clear() to reset accumulated conversation input.


 Genai provider = new OpenAIProvider();
 provider.init("gpt-4.1", configurator);
 provider.prompt("Summarize the project architecture.");
 String answer = provider.perform();
 provider.clear();
 

Configuration keys such as API credentials, base URLs, timeouts, maximum output tokens, tool-call limits, MCP endpoints, and web-search options are interpreted by the individual provider implementations. See each provider's class-level documentation for the supported keys and backend-specific behavior.

Since:
1.2.0
Author:
Viktor Tovstyi
  • Classes
    Class
    Description
    Anthropic-backed implementation of Machai's Genai abstraction.
    Genai implementation that integrates with EPAM CodeMie.
    OpenAI-backed Genai implementation.
    AI provider implementation for managing and invoking host-defined function tools.