Interface ModelProvider

All Known Subinterfaces:
ModelProvider.Custom
All Known Implementing Classes:
ModelProvider.Anthropic, ModelProvider.FromConfig, ModelProvider.GoogleAIGemini, ModelProvider.HuggingFace, ModelProvider.LocalAI, ModelProvider.Ollama, ModelProvider.OpenAi

Configuration interface for AI model providers used by agents.

ModelProvider defines which AI model and settings to use for agent interactions. Akka supports multiple model providers including hosted services (OpenAI, Anthropic, Google AI Gemini, HuggingFace) and locally running models (Ollama, LocalAI).

Different agents can use different models by specifying the ModelProvider in the agent effect. If no model is specified, the default model from configuration is used.

  • Method Details

    • fromConfig

      static ModelProvider fromConfig()
      Creates a model provider from the default configuration path.

      Reads configuration from akka.javasdk.agent.model-provider.

      Returns:
      a configuration-based model provider
    • fromConfig

      static ModelProvider fromConfig(String configPath)
      Creates a model provider from the specified configuration path.

      Allows using different model configurations for different agents by defining multiple model configurations and referencing them by path.

      Parameters:
      configPath - the configuration path to read model settings from
      Returns:
      a configuration-based model provider
    • anthropic

      static ModelProvider.Anthropic anthropic()
      Settings for the Anthropic Large Language Model provider.
    • googleAiGemini

      static ModelProvider.GoogleAIGemini googleAiGemini()
      Settings for the Google AI Gemini Large Language Model provider.
    • localAI

      static ModelProvider.LocalAI localAI()
      Settings for the Local AI Large Language Model provider.
    • ollama

      static ModelProvider.Ollama ollama()
      Settings for the Ollama Large Language Model provider.
    • openAi

      static ModelProvider.OpenAi openAi()
      Settings for the OpenAI Large Language Model provider.
    • huggingFace

      static ModelProvider.HuggingFace huggingFace()
      Settings for the HuggingFace Large Language Model provider.
    • custom

      static ModelProvider.Custom custom(ModelProvider.Custom provider)