类名:ConfigMapper
java.lang.Object
com.google.adk.models.springai.ConfigMapper
ADK 之间的映射关系
GenerateContentConfig 以及 Spring AI ChatOptions 在两个方向上都是如此。-
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescriptionorg.springframework.ai.chat.prompt.ChatOptions在没有提供 ADK 配置的情况下,会创建默认的 ChatOptions。booleanisChatOptionsValid(@Nullable org.springframework.ai.chat.prompt.ChatOptions chatOptions) 验证 Spring AI 的功能是否正常。ChatOptions这些数值位于有效的 ADK 生成范围之内。booleanisConfigurationValid(Optional<com.google.genai.types.GenerateContentConfig> config) 验证该配置是否与 Spring AI 兼容。@Nullable com.google.genai.types.GenerateContentConfigtoGenerateContentConfig(@Nullable org.springframework.ai.chat.prompt.ChatOptions chatOptions) 将 Spring AI 转换为其他格式或系统ChatOptions发送到一个 ADK(Application Development Kit,应用程序开发工具包)GenerateContentConfig.@Nullable org.springframework.ai.chat.prompt.ChatOptionstoSpringAiChatOptions(Optional<com.google.genai.types.GenerateContentConfig> config) 将 ADK 的 `GenerateContentConfig` 对象转换为 Spring AI 的 `ChatOptions` 对象。
-
构造函数详细信息
-
ConfigMapper
public ConfigMapper()
-
-
方法详细信息(Method Details)
-
toSpringAiChatOptions
public @Nullable org.springframework.ai.chat.prompt.ChatOptions toSpringAiChatOptions(Optional<com.google.genai.types.GenerateContentConfig> config) 将 ADK 的 `GenerateContentConfig` 对象转换为 Spring AI 的 `ChatOptions` 对象。当……的时候
GenerateContentConfig.responseJsonSchema()或者GenerateContentConfig.responseSchema()如果该选项存在,则返回的选项会实现相应的功能/行为。StructuredOutputChatOptions该数据结构携带了序列化后的 JSON 数据格式。- Parameters:
config- The ADK configuration to convert- Returns:
- Spring AI ChatOptions or null if no config provided
-
toGenerateContentConfig
public @Nullable com.google.genai.types.GenerateContentConfig toGenerateContentConfig(@Nullable org.springframework.ai.chat.prompt.ChatOptions chatOptions) 将 Spring AI 转换为其他格式或系统ChatOptions发送到一个 ADK(Application Development Kit,应用程序开发工具包)GenerateContentConfig.当……的时候
chatOptionsimplementsStructuredOutputChatOptions当输出模式(output schema)不为空时,解析后的模式(parsed schema)会被设置为……GenerateContentConfig.responseJsonSchema()响应的 MIME 类型为 JSON。- Parameters:
chatOptions- The Spring AI chat options to convert, or null- Returns:
- ADK
GenerateContentConfig, or null ifchatOptionsis null
-
createDefaultChatOptions
public org.springframework.ai.chat.prompt.ChatOptions createDefaultChatOptions()在没有提供 ADK 配置的情况下,会创建默认的 ChatOptions。- Returns:
- Basic ChatOptions with reasonable defaults
-
isConfigurationValid
验证该配置是否与 Spring AI 兼容。- Parameters:
config- The ADK configuration to validate- Returns:
- true if configuration is valid and supported
-
isChatOptionsValid
public boolean isChatOptionsValid(@Nullable org.springframework.ai.chat.prompt.ChatOptions chatOptions) 验证 Spring AI 的功能是否正常。ChatOptions这些数值位于有效的 ADK 生成范围之内。- Parameters:
chatOptions- The Spring AI chat options to validate, or null- Returns:
- true if the options are valid
-