ModelProviderSupport
public final class ModelProviderSupport
源码Source
io/agentscope/core/model/ModelProviderSupport.java:19–89模型提供者 Support,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.core.model 包。核心成员包括 findAssignableComponent、firstNonBlank、trimToNull、intOption、booleanOption、stringOption。
Shared helpers for model providers.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static T T findAssignableComponent(ModelCreationContext context, Class<T> componentType)static | 查找 `findAssignableComponent`。 Finds the assignable component. |
public static String firstNonBlank(String... values)static | 设置该参数。 Performs the first non blank operation. |
public static String trimToNull(String value)static | 设置该参数。 Performs the trim to null operation. |
public static Integer intOption(ModelCreationContext context, String key)static | 执行 `intOption` 方法。 Performs the int option operation. |
public static Boolean booleanOption(ModelCreationContext context, String key)static | 执行 `booleanOption` 方法。 Performs the boolean option operation. |
public static String stringOption(ModelCreationContext context, String key)static | 执行 `stringOption` 方法。 Performs the string option operation. |
方法详情Method Detail
findAssignableComponent
public static T T findAssignableComponent(ModelCreationContext context, Class<T> componentType)
static
查找 findAssignableComponent。
Finds the assignable component.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
context | ModelCreationContext | 上下文(类型 `ModelCreationContext`)。The context. |
componentType | Class<T> | component 类型(类型 `Class`)。The component type. |
T返回T。Returns t.
源码Source
io/agentscope/core/model/ModelProviderSupport.java:23–31firstNonBlank
public static String firstNonBlank(String... values)
static
设置该参数。
Performs the first non blank operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
values varargs | String... | 值(类型 `String...`)。The values. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/model/ModelProviderSupport.java:33–44trimToNull
public static String trimToNull(String value)
static
设置该参数。
Performs the trim to null operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | String | 值(类型 `String`)。The value. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/model/ModelProviderSupport.java:46–52intOption
public static Integer intOption(ModelCreationContext context, String key)
static
执行 intOption 方法。
Performs the int option operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
context | ModelCreationContext | 上下文(类型 `ModelCreationContext`)。The context. |
key | String | 键(类型 `String`)。The key. |
Integer返回数值结果。Returns a numeric result.
源码Source
io/agentscope/core/model/ModelProviderSupport.java:54–64booleanOption
public static Boolean booleanOption(ModelCreationContext context, String key)
static
执行 booleanOption 方法。
Performs the boolean option operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
context | ModelCreationContext | 上下文(类型 `ModelCreationContext`)。The context. |
key | String | 键(类型 `String`)。The key. |
Boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/core/model/ModelProviderSupport.java:66–76stringOption
public static String stringOption(ModelCreationContext context, String key)
static
执行 stringOption 方法。
Performs the string option operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
context | ModelCreationContext | 上下文(类型 `ModelCreationContext`)。The context. |
key | String | 键(类型 `String`)。The key. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/model/ModelProviderSupport.java:78–88