Package org.machanism.machai.ai.provider.impl
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
OpenAIProvideradapts 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.AnthropicProvideradapts 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.CodeMieProviderintegrates 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.ToolsProviderexecutes 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