Package org.machanism.machai.ai.provider
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
Genaidefines the primary lifecycle and execution contract for conversational and tool-enabled AI providers.EmbeddingProviderdefines the contract for providers that can generate embedding vectors for semantic and similarity-based workflows.AbstractAIProvidersupplies reusable base behavior for configuration-driven providers, including timeout handling, request logging, optional web-search support, MCP server registration, and guarded tool invocation.GenaiAdapterprovides a delegating implementation that enables wrapper, adapter, and decorator patterns around a concreteGenaiinstance.
Included provider families
openaicontains 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.codemiecontains the CodeMie integration that acquires access tokens, resolves supported hosted model families, and delegates requests to the appropriate provider implementation.claudecontains 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.
-
ClassDescriptionBase implementation of the
Genaicontract shared by concrete provider integrations.EmbeddingProvider defines the contract for AI embedding providers.Contract for a generative-AI provider integration.DelegatingGenaiimplementation.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").