# 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.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `LlmRegistry.LlmFactory`
  The factory interface for creating LLM instances.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BaseLlm`
  `getLlm(String modelName)`
  Returns an LLM instance for the given model name, using a cached or new factory-created instance.
  `static void`
  `registerLlm(String modelNamePattern, LlmRegistry.LlmFactory factory)`
  Registers a factory for model names matching the given regex pattern.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.