Class LlmRegistry

java.lang.Object
com.google.adk.models.LlmRegistry

public final class LlmRegistry extends Object
Central registry for managing Large Language Model (LLM) instances.
  • Method Details

    • registerLlm

      public static void registerLlm(String modelNamePattern, LlmRegistry.LlmFactory factory)
      Registers a factory for model names matching the given regex pattern.
      Parameters:
      modelNamePattern - Regex pattern for matching model names.
      factory - Factory to create LLM instances.
    • getLlm

      public static BaseLlm getLlm(String modelName)
      Returns an LLM instance for the given model name, using a cached or new factory-created instance.
      Parameters:
      modelName - Model name to look up.
      Returns:
      Matching BaseLlm instance.
      Throws:
      IllegalArgumentException - If no factory matches the model name.