OpenAIRequest
@JsonInclude(JsonInclude.Include.NON_NULL) public class OpenAIRequest
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:42–612OpenAI 请求,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.openai.dto 包。核心成员包括 getModel、setModel、getMessages、setMessages、getStream、setStream。
OpenAI Chat Completion API request DTO.
This class represents the request structure for OpenAI's Chat Completion API.
Example JSON:
`{
"model": "gpt-4o",
"messages": [...],
"stream": true,
"temperature": 0.7,
"max_tokens": 1000
}
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 A class in io.agentscope.extensions.model.openai.dto that talks to model services and returns generated or embedded output. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public OpenAIRequest() | 初始化 `OpenAIRequest` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
OpenAIRequest
public OpenAIRequest()
初始化 OpenAIRequest 实例。
Creates a new instance.
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:183方法详情Method Detail
getModel
public String getModel()
获取模型。
Returns the model.
Stringio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:195–197setModel
public void setModel(String model)
设置模型。
Sets the model.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
model | String | 模型实例(类型 `String`)。The model. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:199–201getMessages
public List<OpenAIMessage> getMessages()
获取消息。
Returns the messages.
List<OpenAIMessage>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:203–205setMessages
public void setMessages(List<OpenAIMessage> messages)
设置消息。
Sets the messages.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messages | List<OpenAIMessage> | 消息列表(类型 `List`)。The messages. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:207–209getStream
public Boolean getStream()
获取流。
Returns the stream.
Booleanio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:211–213setStream
public void setStream(Boolean stream)
设置流。
Sets the stream.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
stream | Boolean | 流(类型 `Boolean`)。The stream. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:215–217getStreamOptions
public OpenAIStreamOptions getStreamOptions()
获取流选项。
Returns the stream options.
OpenAIStreamOptionsio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:219–221setStreamOptions
public void setStreamOptions(OpenAIStreamOptions streamOptions)
设置流选项。
Sets the stream options.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
streamOptions | OpenAIStreamOptions | 流选项(类型 `OpenAIStreamOptions`)。The stream options. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:223–225getTemperature
public Double getTemperature()
获取 getTemperature。
Returns the temperature.
Doubleio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:227–229setTemperature
public void setTemperature(Double temperature)
设置 setTemperature。
Sets the temperature.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
temperature | Double | temperature(类型 `Double`)。The temperature. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:231–233getTopP
public Double getTopP()
获取 getTopP。
Returns the top p.
Doubleio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:235–237setTopP
public void setTopP(Double topP)
设置 setTopP。
Sets the top p.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
topP | Double | top P(类型 `Double`)。The top p. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:239–241getMaxTokens
public Integer getMaxTokens()
获取最大令牌数。
Returns the max tokens.
Integerio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:243–245setMaxTokens
public void setMaxTokens(Integer maxTokens)
设置最大令牌数。
Sets the max tokens.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxTokens | Integer | 最大令牌数(类型 `Integer`)。The max tokens. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:247–249getMaxCompletionTokens
public Integer getMaxCompletionTokens()
获取最大补全令牌数。
Returns the max completion tokens.
Integerio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:251–253setMaxCompletionTokens
public void setMaxCompletionTokens(Integer maxCompletionTokens)
设置最大补全令牌数。
Sets the max completion tokens.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxCompletionTokens | Integer | 最大补全令牌数(类型 `Integer`)。The max completion tokens. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:255–257getFrequencyPenalty
public Double getFrequencyPenalty()
获取 getFrequencyPenalty。
Returns the frequency penalty.
Doubleio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:259–261setFrequencyPenalty
public void setFrequencyPenalty(Double frequencyPenalty)
设置 setFrequencyPenalty。
Sets the frequency penalty.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
frequencyPenalty | Double | frequency Penalty(类型 `Double`)。The frequency penalty. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:263–265getPresencePenalty
public Double getPresencePenalty()
获取 getPresencePenalty。
Returns the presence penalty.
Doubleio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:267–269setPresencePenalty
public void setPresencePenalty(Double presencePenalty)
设置 setPresencePenalty。
Sets the presence penalty.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
presencePenalty | Double | 在线状态 Penalty(类型 `Double`)。The presence penalty. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:271–273getStop
public Object getStop()
获取停止。
Returns the stop.
Objectio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:275–277setStop
public void setStop(Object stop)
设置停止。
Sets the stop.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
stop | Object | 停止(类型 `Object`)。The stop. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:279–281getSeed
public Integer getSeed()
获取预置。
Returns the seed.
Integerio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:283–285setSeed
public void setSeed(Integer seed)
设置预置。
Sets the seed.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
seed | Integer | 预置(类型 `Integer`)。The seed. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:287–289getN
public Integer getN()
获取N。
Returns the n.
Integerio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:291–293setN
public void setN(Integer n)
设置N。
Sets the n.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
n | Integer | n(类型 `Integer`)。The n. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:295–297getTools
public List<OpenAITool> getTools()
获取工具。
Returns the tools.
List<OpenAITool>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:299–301setTools
public void setTools(List<OpenAITool> tools)
设置工具。
Sets the tools.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tools | List<OpenAITool> | 工具列表(类型 `List`)。The tools. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:303–305getToolChoice
public Object getToolChoice()
获取工具选项。
Returns the tool choice.
Objectio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:307–309setToolChoice
public void setToolChoice(Object toolChoice)
设置工具选项。
Sets the tool choice.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolChoice | Object | 工具选项(类型 `Object`)。The tool choice. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:311–313getUser
public String getUser()
获取用户。
Returns the user.
Stringio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:315–317setUser
public void setUser(String user)
设置用户。
Sets the user.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
user | String | 用户(类型 `String`)。The user. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:319–321getResponseFormat
public Object getResponseFormat()
获取响应格式。
Returns the response format.
Objectio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:323–325setResponseFormat
public void setResponseFormat(Object responseFormat)
设置响应格式。
Sets the response format.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
responseFormat | Object | 响应格式(类型 `Object`)。The response format. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:327–329getLogprobs
public Boolean getLogprobs()
获取 getLogprobs。
Returns the logprobs.
Booleanio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:331–333setLogprobs
public void setLogprobs(Boolean logprobs)
设置 setLogprobs。
Sets the logprobs.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
logprobs | Boolean | logprobs(类型 `Boolean`)。The logprobs. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:335–337getTopLogprobs
public Integer getTopLogprobs()
获取 getTopLogprobs。
Returns the top logprobs.
Integerio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:339–341setTopLogprobs
public void setTopLogprobs(Integer topLogprobs)
设置 setTopLogprobs。
Sets the top logprobs.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
topLogprobs | Integer | top Logprobs(类型 `Integer`)。The top logprobs. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:343–345getReasoningEffort
public String getReasoningEffort()
获取 getReasoningEffort。
Returns the reasoning effort.
Stringio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:347–349setReasoningEffort
public void setReasoningEffort(String reasoningEffort)
设置 setReasoningEffort。
Sets the reasoning effort.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
reasoningEffort | String | 推理 Effort(类型 `String`)。The reasoning effort. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:351–353getThinkingBudget
public Integer getThinkingBudget()
获取 getThinkingBudget。
Returns the thinking budget.
Integerio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:355–357setThinkingBudget
public void setThinkingBudget(Integer thinkingBudget)
设置 setThinkingBudget。
Sets the thinking budget.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
thinkingBudget | Integer | thinking 预算(类型 `Integer`)。The thinking budget. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:359–361getParallelToolCalls
public Boolean getParallelToolCalls()
获取 getParallelToolCalls。
Returns the parallel tool calls.
Booleanio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:363–365setParallelToolCalls
public void setParallelToolCalls(Boolean parallelToolCalls)
设置 setParallelToolCalls。
Sets the parallel tool calls.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
parallelToolCalls | Boolean | parallel 工具调用(类型 `Boolean`)。The parallel tool calls. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:367–369getServiceTier
public String getServiceTier()
获取 getServiceTier。
Returns the service tier.
Stringio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:371–373setServiceTier
public void setServiceTier(String serviceTier)
设置 setServiceTier。
Sets the service tier.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
serviceTier | String | 服务 Tier(类型 `String`)。The service tier. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:375–377getStore
public Boolean getStore()
获取存储。
Returns the store.
Booleanio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:379–381setStore
public void setStore(Boolean store)
设置存储。
Sets the store.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | Boolean | 存储实例(类型 `Boolean`)。The store. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:383–385getMetadata
public Map<String, Object> getMetadata()
获取元数据。
Returns the metadata.
Map<String, Object>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:387–389setMetadata
public void setMetadata(Map<String, Object> metadata)
设置元数据。
Sets the metadata.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metadata | Map<String, Object> | 元数据(类型 `Map`)。The metadata. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:391–393getPrediction
public Map<String, Object> getPrediction()
获取 getPrediction。
Returns the prediction.
Map<String, Object>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:395–397setPrediction
public void setPrediction(Map<String, Object> prediction)
设置 setPrediction。
Sets the prediction.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
prediction | Map<String, Object> | prediction(类型 `Map`)。The prediction. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:399–401getModalities
public List<String> getModalities()
获取 getModalities。
Returns the modalities.
List<String>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:403–405setModalities
public void setModalities(List<String> modalities)
设置 setModalities。
Sets the modalities.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
modalities | List<String> | modalities(类型 `List`)。The modalities. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:407–409getAudio
public Map<String, Object> getAudio()
获取音频。
Returns the audio.
Map<String, Object>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:411–413setAudio
public void setAudio(Map<String, Object> audio)
设置音频。
Sets the audio.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
audio | Map<String, Object> | 音频(类型 `Map`)。The audio. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:415–417getIncludeReasoning
public Boolean getIncludeReasoning()
获取 getIncludeReasoning。
Returns the include reasoning.
Booleanio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:419–421setIncludeReasoning
public void setIncludeReasoning(Boolean includeReasoning)
设置 setIncludeReasoning。
Sets the include reasoning.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
includeReasoning | Boolean | include 推理(类型 `Boolean`)。The include reasoning. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:423–425getExtraParams
public Map<String, Object> getExtraParams()
获取 getExtraParams。
Returns the extra params.
Map<String, Object>io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:427–430addExtraParam
public void addExtraParam(String key, Object value)
添加 addExtraParam。
Adds the extra param.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
value | Object | 值(类型 `Object`)。The value. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:432–438setExtraParams
public void setExtraParams(Map<String, Object> extraParams)
设置 setExtraParams。
Sets the extra params.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
extraParams | Map<String, Object> | extra 参数(类型 `Map`)。The extra params. |
io/agentscope/extensions/model/openai/dto/OpenAIRequest.java:440–442builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/extensions/model/openai/dto/OpenAIRequest.java:444–446嵌套类详情Nested Class Detail
Builder
public static class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.openai.dto 包。核心成员包括 model、messages、stream、streamOptions、temperature、topP。
A class in io.agentscope.extensions.model.openai.dto that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.openai.dto.