AS AgentScopeAPI 手册 / API Reference

OpenAIProperties

@ConfigurationProperties(prefix = "agentscope.openai") public class OpenAIProperties
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:38–123

OpenAI 属性,承载智能体的部署、调度与服务化运行。位于 io.agentscope.spring.boot.openai 包。核心成员包括 isEnabled、setEnabled、getApiKey、setApiKey、getModelName、setModelName。

OpenAI provider specific settings.

Example configuration:

`agentscope:
model:
provider: openai
openai:
enabled: true
api-key: ${OPENAI_API_KEY}
model-name: gpt-4.1-mini
# base-url: https://api.openai.com/v1 # optional, for compatible endpoints
# endpoint-path: /v1/chat/completions # optional, for custom endpoint paths
stream: true
`

方法摘要Method Summary

方法Method说明Description
public boolean isEnabled()
判断是否已启用。
Returns whether the enabled.
public void setEnabled(boolean enabled)
设置已启用。
Sets the enabled.
public String getApiKey()
获取API 键。
Returns the api key.
public void setApiKey(String apiKey)
设置API 键。
Sets the api key.
public String getModelName()
获取模型名称。
Returns the model name.
public void setModelName(String modelName)
设置模型名称。
Sets the model name.
public String getBaseUrl()
获取基类 URL。
Returns the base url.
public void setBaseUrl(String baseUrl)
设置基类 URL。
Sets the base url.
public String getEndpointPath()
获取端点路径。
Returns the endpoint path.
public void setEndpointPath(String endpointPath)
设置端点路径。
Sets the endpoint path.
public boolean isStream()
判断是否流。
Returns whether the stream.
public void setStream(boolean stream)
设置流。
Sets the stream.

方法详情Method Detail

isEnabled

public boolean isEnabled()

判断是否已启用。

Returns whether the enabled.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:76–78

setEnabled

public void setEnabled(boolean enabled)

设置已启用。

Sets the enabled.

参数Parameters
名称Name类型Type说明Description
enabledboolean已启用(类型 `boolean`)。The enabled.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:80–82

getApiKey

public String getApiKey()

获取API 键。

Returns the api key.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:84–86

setApiKey

public void setApiKey(String apiKey)

设置API 键。

Sets the api key.

参数Parameters
名称Name类型Type说明Description
apiKeyStringAPI 键(类型 `String`)。The api key.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:88–90

getModelName

public String getModelName()

获取模型名称。

Returns the model name.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:92–94

setModelName

public void setModelName(String modelName)

设置模型名称。

Sets the model name.

参数Parameters
名称Name类型Type说明Description
modelNameString模型名称(类型 `String`)。The model name.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:96–98

getBaseUrl

public String getBaseUrl()

获取基类 URL。

Returns the base url.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:100–102

setBaseUrl

public void setBaseUrl(String baseUrl)

设置基类 URL。

Sets the base url.

参数Parameters
名称Name类型Type说明Description
baseUrlString基类 URL(类型 `String`)。The base url.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:104–106

getEndpointPath

public String getEndpointPath()

获取端点路径。

Returns the endpoint path.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:108–110

setEndpointPath

public void setEndpointPath(String endpointPath)

设置端点路径。

Sets the endpoint path.

参数Parameters
名称Name类型Type说明Description
endpointPathString端点路径(类型 `String`)。The endpoint path.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:112–114

isStream

public boolean isStream()

判断是否流。

Returns whether the stream.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:116–118

setStream

public void setStream(boolean stream)

设置流。

Sets the stream.

参数Parameters
名称Name类型Type说明Description
streamboolean流(类型 `boolean`)。The stream.
源码Source io/agentscope/spring/boot/openai/OpenAIProperties.java:120–122
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.