io.enterpriseai.model.ChatRequest
Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/model/ChatRequest.java. Back to the Java SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Model ChatRequest
Body of POST /v1/gateway/chat/completions (OpenAI compatible plus eai).
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
model | String | yes | Model alias of the gateway that answers the request. |
messages | List<ChatMessage> | yes | Messages of the conversation, in order. |
temperature | Double | yes | Sampling temperature, left out of the JSON when null. |
maxTokens | Integer | yes | Maximum output tokens; when set, it is the output assumed for the worst case. |
tools | List<Map<String, Object>> | yes | Tools its external agents may invoke (names or patterns such as crm.*). |
stream | Boolean | yes | True for a response streamed as SSE; left out of the JSON when null. |
eai | EaiExtension | yes | The eai extension body field of gateway calls. |
ChatRequest.withStream
ChatRequest withStream(boolean value)
Copy with stream set.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
value | boolean | yes | Value of stream in the copy. |
Returns: ChatRequest. A ChatRequest: Body of POST /v1/gateway/chat/completions (OpenAI compatible plus eai).
Class ChatRequest.Builder
Fluent builder.
Builder.agent
Builder agent(String agent, String session, String run, String task)
Sets the agent, session, run and task ids sent in the eai extension.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent | String | yes | Agent id (eai.agent_id), may be null. | |
session | String | yes | Session id (eai.session_id), may be null. | |
run | String | yes | Run id (eai.run_id), may be null. | |
task | String | yes | Task id (eai.task_id), may be null. |
Returns: Builder. A Builder: Fluent builder.
Builder.assistant
Builder assistant(String text)
Appends an assistant message.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | String | yes | Text of the assistant message. |
Returns: Builder. A Builder: Fluent builder.
Builder.build
ChatRequest build()
Builds the request; the eai extension is set only when at least one of its fields was given.
This element takes no parameter.
Returns: ChatRequest. A ChatRequest: Body of POST /v1/gateway/chat/completions (OpenAI compatible plus eai).
Builder.dataClassification
Builder dataClassification(String c)
Sets eai.data_classification.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
c | String | yes | Classification of the data sent, such as confidential. |
Returns: Builder. A Builder: Fluent builder.
Builder.effort
Builder effort(Effort e)
Sets the normalized reasoning effort eai.effort.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
e | Effort | yes | Requested Effort. |
Returns: Builder. A Builder: Fluent builder.
Builder.fallbackPolicy
Builder fallbackPolicy(String p)
Sets eai.fallback_policy.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
p | String | yes | Fallback policy of model routing. |
Returns: Builder. A Builder: Fluent builder.
Builder.maxTokens
Builder maxTokens(int n)
Sets max_tokens.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
n | int | yes | Maximum number of tokens to generate. |
Returns: Builder. A Builder: Fluent builder.
Builder.message
Builder message(ChatMessage m)
Appends a ready made message.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
m | ChatMessage | yes | ChatMessage to append to messages. |
Returns: Builder. A Builder: Fluent builder.
Builder.purpose
Builder purpose(String p)
Sets eai.purpose, the purpose of the processing.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
p | String | yes | Purpose of the processing. |
Returns: Builder. A Builder: Fluent builder.
Builder.regionAllow
Builder regionAllow(List<String> regions)
Sets eai.region_allow from a copy of the list.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
regions | List<String> | yes | Processing regions allowed for routing. |
Returns: Builder. A Builder: Fluent builder.
Builder.system
Builder system(String text)
Appends a system message.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | String | yes | Text of the system message. |
Returns: Builder. A Builder: Fluent builder.
Builder.temperature
Builder temperature(double t)
Sets the sampling temperature.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
t | double | yes | Sampling temperature. |
Returns: Builder. A Builder: Fluent builder.
Builder.tools
Builder tools(List<Map<String, Object>> t)
Sets the OpenAI compatible tools definitions.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
t | List<Map<String, Object>> | yes | Tool definitions, one map per tool. |
Returns: Builder. A Builder: Fluent builder.
Builder.user
Builder user(String text)
Appends a user message.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | String | yes | Text of the user message. |
Returns: Builder. A Builder: Fluent builder.