Class FakeLlmClientFactory

java.lang.Object
com.agentforge4j.llm.fake.FakeLlmClientFactory
All Implemented Interfaces:
LlmClientFactory

public final class FakeLlmClientFactory extends Object implements LlmClientFactory
LlmClientFactory for the fake provider, discovered via ServiceLoader. Requires a FakeConfiguration (carrying the shared FakeResponseSource); any other configuration type raises an LlmProviderConfigurationException.
  • Constructor Details

    • FakeLlmClientFactory

      public FakeLlmClientFactory()
  • Method Details

    • getProviderName

      public String getProviderName()
      Description copied from interface: LlmClientFactory
      Returns the provider id this factory creates clients for.
      Specified by:
      getProviderName in interface LlmClientFactory
      Returns:
      non-blank provider id such as "openai" or "ollama"
    • requiresApiKey

      public boolean requiresApiKey()
      Description copied from interface: LlmClientFactory
      Returns true if this provider requires an API key to function. Providers that run locally without authentication (e.g. Ollama, vLLM) should override this to return false.

      Used by the bootstrap module to determine whether to include a provider when no explicit API key is configured.

      Specified by:
      requiresApiKey in interface LlmClientFactory
      Returns:
      true if an API key is required; false otherwise
    • create

      public LlmClient create(LlmClientFactoryContext context)
      Creates a fake client from a LlmClientFactoryContext. The fake provider's load-bearing input is a FakeResponseSource, which cannot be expressed as neutral string options, so it must be supplied programmatically as a FakeConfiguration (via withLlmProvider) — the neutral env/system-property path cannot configure it.
      Specified by:
      create in interface LlmClientFactory
      Parameters:
      context - the factory inputs
      Returns:
      a new fake LLM client
      Throws:
      LlmProviderConfigurationException - if the configuration is not a FakeConfiguration