类 LlmRegistry

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

public final class LlmRegistry extends Object
用于管理大型语言模型(LLM)实例的中央注册系统。
  • 嵌套类概述

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    用于创建大型语言模型(LLM)实例的工厂接口。
  • 方法概述

    Modifier and Type
    Method
    Description
    static BaseLlm
    getLlm(String modelName)
    根据给定的模型名称,返回一个大型语言模型(LLM)实例;该实例可以是已缓存的,也可以是工厂新建的。
    static void
    registerLlm(String modelNamePattern, LlmRegistry.LlmFactory factory)
    为那些名称符合给定正则表达式模式的模型注册一个工厂(即用于创建这些模型的类或函数)。

    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)
      为那些名称符合给定正则表达式模式的模型注册一个工厂(即用于创建这些模型的类或函数)。
      Parameters:
      modelNamePattern - Regex pattern for matching model names.
      factory - Factory to create LLM instances.
    • getLlm

      public static BaseLlm getLlm(String modelName)
      根据给定的模型名称,返回一个大型语言模型(LLM)实例;该实例可以是已缓存的,也可以是工厂新建的。
      Parameters:
      modelName - Model name to look up.
      Returns:
      Matching BaseLlm instance.
      Throws:
      IllegalArgumentException - If no factory matches the model name.