This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 45390060aa70 CAMEL-22918: Add header metadata to camel-openai
45390060aa70 is described below
commit 45390060aa70124b85bf226f099ebbcbac5178e6
Author: James Netherton <[email protected]>
AuthorDate: Thu Jan 29 08:25:10 2026 +0000
CAMEL-22918: Add header metadata to camel-openai
---
.../apache/camel/catalog/components/openai.json | 19 ++
.../org/apache/camel/component/openai/openai.json | 19 ++
.../camel/component/openai/OpenAIConstants.java | 21 ++
.../camel/component/openai/OpenAIEndpoint.java | 3 +-
.../endpoint/dsl/OpenAIEndpointBuilderFactory.java | 234 +++++++++++++++++++++
5 files changed, 295 insertions(+), 1 deletion(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
index 2bdedda00751..987bbb3c5848 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
@@ -30,6 +30,25 @@
"model": { "index": 3, "kind": "property", "displayName": "Model",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Default model for all endpoints" },
"autowiredEnabled": { "index": 4, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
},
+ "headers": {
+ "CamelOpenAIUserMessage": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The user message to send to the OpenAI chat completion
API", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#USER_MESSAGE" },
+ "CamelOpenAISystemMessage": { "index": 1, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The system message to provide context and instructions
to the model", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#SYSTEM_MESSAGE" },
+ "CamelOpenAIDeveloperMessage": { "index": 2, "kind": "header",
"displayName": "", "group": "producer", "label": "", "required": false,
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The developer message to provide
additional instructions to the model", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#DEVELOPER_MESSAGE" },
+ "CamelOpenAIModel": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The model to use for chat completion (e.g., gpt-4,
gpt-3.5-turbo)", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#MODEL" },
+ "CamelOpenAITemperature": { "index": 4, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Double",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "Controls randomness in the response. Higher values
(e.g., 0.8) make output more random, lower values (e.g., 0.2) make it more
deterministic", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#TEMPERATURE" },
+ "CamelOpenAITopP": { "index": 5, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "Double",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "An alternative to temperature for controlling
randomness. Uses nucleus sampling where the model considers tokens with top_p
probability mass", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#TOP_P" },
+ "CamelOpenAIMaxTokens": { "index": 6, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "Integer",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The maximum number of tokens to generate in the
completion", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#MAX_TOKENS" },
+ "CamelOpenAIStreaming": { "index": 7, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "Boolean",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "Whether to stream the response back incrementally",
"constantName": "org.apache.camel.component.openai.OpenAIConstants#STREAMING" },
+ "CamelOpenAIOutputClass": { "index": 8, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Class",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The Java class to use for structured output parsing",
"constantName":
"org.apache.camel.component.openai.OpenAIConstants#OUTPUT_CLASS" },
+ "CamelOpenAIJsonSchema": { "index": 9, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The JSON schema to use for structured output
validation", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#JSON_SCHEMA" },
+ "CamelOpenAIResponseModel": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "", "required": false,
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The model used for the completion
response", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#RESPONSE_MODEL" },
+ "CamelOpenAIResponseId": { "index": 11, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The unique identifier for the completion response",
"constantName": "org.apache.camel.component.openai.OpenAIConstants#RESPONSE_ID"
},
+ "CamelOpenAIFinishReason": { "index": 12, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The reason the completion finished (e.g., stop, length,
content_filter)", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#FINISH_REASON" },
+ "CamelOpenAIPromptTokens": { "index": 13, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Integer",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The number of tokens used in the prompt",
"constantName":
"org.apache.camel.component.openai.OpenAIConstants#PROMPT_TOKENS" },
+ "CamelOpenAICompletionTokens": { "index": 14, "kind": "header",
"displayName": "", "group": "producer", "label": "", "required": false,
"javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The number of tokens used in the
completion", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#COMPLETION_TOKENS" },
+ "CamelOpenAITotalTokens": { "index": 15, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Integer",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The total number of tokens used (prompt completion)",
"constantName":
"org.apache.camel.component.openai.OpenAIConstants#TOTAL_TOKENS" },
+ "CamelOpenAIResponse": { "index": 16, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"com.openai.models.ChatCompletion", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "The complete OpenAI
response object", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#RESPONSE" }
+ },
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "The operation to perform
(currently only chat-completion is supported)" },
"additionalBodyProperty": { "index": 1, "kind": "parameter",
"displayName": "Additional Body Property", "group": "producer", "label": "",
"required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "prefix":
"additionalBodyProperty.", "multiValue": true, "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configur [...]
diff --git
a/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
b/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
index 2bdedda00751..987bbb3c5848 100644
---
a/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
+++
b/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
@@ -30,6 +30,25 @@
"model": { "index": 3, "kind": "property", "displayName": "Model",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Default model for all endpoints" },
"autowiredEnabled": { "index": 4, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
},
+ "headers": {
+ "CamelOpenAIUserMessage": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The user message to send to the OpenAI chat completion
API", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#USER_MESSAGE" },
+ "CamelOpenAISystemMessage": { "index": 1, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The system message to provide context and instructions
to the model", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#SYSTEM_MESSAGE" },
+ "CamelOpenAIDeveloperMessage": { "index": 2, "kind": "header",
"displayName": "", "group": "producer", "label": "", "required": false,
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The developer message to provide
additional instructions to the model", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#DEVELOPER_MESSAGE" },
+ "CamelOpenAIModel": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The model to use for chat completion (e.g., gpt-4,
gpt-3.5-turbo)", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#MODEL" },
+ "CamelOpenAITemperature": { "index": 4, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Double",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "Controls randomness in the response. Higher values
(e.g., 0.8) make output more random, lower values (e.g., 0.2) make it more
deterministic", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#TEMPERATURE" },
+ "CamelOpenAITopP": { "index": 5, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "Double",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "An alternative to temperature for controlling
randomness. Uses nucleus sampling where the model considers tokens with top_p
probability mass", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#TOP_P" },
+ "CamelOpenAIMaxTokens": { "index": 6, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "Integer",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The maximum number of tokens to generate in the
completion", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#MAX_TOKENS" },
+ "CamelOpenAIStreaming": { "index": 7, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType": "Boolean",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "Whether to stream the response back incrementally",
"constantName": "org.apache.camel.component.openai.OpenAIConstants#STREAMING" },
+ "CamelOpenAIOutputClass": { "index": 8, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Class",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The Java class to use for structured output parsing",
"constantName":
"org.apache.camel.component.openai.OpenAIConstants#OUTPUT_CLASS" },
+ "CamelOpenAIJsonSchema": { "index": 9, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The JSON schema to use for structured output
validation", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#JSON_SCHEMA" },
+ "CamelOpenAIResponseModel": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "", "required": false,
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The model used for the completion
response", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#RESPONSE_MODEL" },
+ "CamelOpenAIResponseId": { "index": 11, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The unique identifier for the completion response",
"constantName": "org.apache.camel.component.openai.OpenAIConstants#RESPONSE_ID"
},
+ "CamelOpenAIFinishReason": { "index": 12, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "String",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The reason the completion finished (e.g., stop, length,
content_filter)", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#FINISH_REASON" },
+ "CamelOpenAIPromptTokens": { "index": 13, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Integer",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The number of tokens used in the prompt",
"constantName":
"org.apache.camel.component.openai.OpenAIConstants#PROMPT_TOKENS" },
+ "CamelOpenAICompletionTokens": { "index": 14, "kind": "header",
"displayName": "", "group": "producer", "label": "", "required": false,
"javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "The number of tokens used in the
completion", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#COMPLETION_TOKENS" },
+ "CamelOpenAITotalTokens": { "index": 15, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType": "Integer",
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "description": "The total number of tokens used (prompt completion)",
"constantName":
"org.apache.camel.component.openai.OpenAIConstants#TOTAL_TOKENS" },
+ "CamelOpenAIResponse": { "index": 16, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"com.openai.models.ChatCompletion", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "The complete OpenAI
response object", "constantName":
"org.apache.camel.component.openai.OpenAIConstants#RESPONSE" }
+ },
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "The operation to perform
(currently only chat-completion is supported)" },
"additionalBodyProperty": { "index": 1, "kind": "parameter",
"displayName": "Additional Body Property", "group": "producer", "label": "",
"required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "prefix":
"additionalBodyProperty.", "multiValue": true, "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configur [...]
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConstants.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConstants.java
index d82537c7fde4..da5fe94931ac 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConstants.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConstants.java
@@ -16,32 +16,53 @@
*/
package org.apache.camel.component.openai;
+import org.apache.camel.spi.Metadata;
+
/**
* Constants for OpenAI component headers and properties.
*/
public final class OpenAIConstants {
// Input Headers
+ @Metadata(description = "The user message to send to the OpenAI chat
completion API", javaType = "String")
public static final String USER_MESSAGE = "CamelOpenAIUserMessage";
+ @Metadata(description = "The system message to provide context and
instructions to the model", javaType = "String")
public static final String SYSTEM_MESSAGE = "CamelOpenAISystemMessage";
+ @Metadata(description = "The developer message to provide additional
instructions to the model", javaType = "String")
public static final String DEVELOPER_MESSAGE =
"CamelOpenAIDeveloperMessage";
+ @Metadata(description = "The model to use for chat completion (e.g.,
gpt-4, gpt-3.5-turbo)", javaType = "String")
public static final String MODEL = "CamelOpenAIModel";
+ @Metadata(description = "Controls randomness in the response. Higher
values (e.g., 0.8) make output more random, lower values (e.g., 0.2) make it
more deterministic",
+ javaType = "Double")
public static final String TEMPERATURE = "CamelOpenAITemperature";
+ @Metadata(description = "An alternative to temperature for controlling
randomness. Uses nucleus sampling where the model considers tokens with top_p
probability mass",
+ javaType = "Double")
public static final String TOP_P = "CamelOpenAITopP";
+ @Metadata(description = "The maximum number of tokens to generate in the
completion", javaType = "Integer")
public static final String MAX_TOKENS = "CamelOpenAIMaxTokens";
+ @Metadata(description = "Whether to stream the response back
incrementally", javaType = "Boolean")
public static final String STREAMING = "CamelOpenAIStreaming";
+ @Metadata(description = "The Java class to use for structured output
parsing", javaType = "Class")
public static final String OUTPUT_CLASS = "CamelOpenAIOutputClass";
+ @Metadata(description = "The JSON schema to use for structured output
validation", javaType = "String")
public static final String JSON_SCHEMA = "CamelOpenAIJsonSchema";
// Output Headers
+ @Metadata(description = "The model used for the completion response",
javaType = "String")
public static final String RESPONSE_MODEL = "CamelOpenAIResponseModel";
+ @Metadata(description = "The unique identifier for the completion
response", javaType = "String")
public static final String RESPONSE_ID = "CamelOpenAIResponseId";
+ @Metadata(description = "The reason the completion finished (e.g., stop,
length, content_filter)", javaType = "String")
public static final String FINISH_REASON = "CamelOpenAIFinishReason";
+ @Metadata(description = "The number of tokens used in the prompt",
javaType = "Integer")
public static final String PROMPT_TOKENS = "CamelOpenAIPromptTokens";
+ @Metadata(description = "The number of tokens used in the completion",
javaType = "Integer")
public static final String COMPLETION_TOKENS =
"CamelOpenAICompletionTokens";
+ @Metadata(description = "The total number of tokens used (prompt +
completion)", javaType = "Integer")
public static final String TOTAL_TOKENS = "CamelOpenAITotalTokens";
// Output Exchange Properties
+ @Metadata(description = "The complete OpenAI response object", javaType =
"com.openai.models.ChatCompletion")
public static final String RESPONSE = "CamelOpenAIResponse";
private OpenAIConstants() {
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
index 09795aa3574d..0ab1468e442f 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
@@ -37,7 +37,8 @@ import org.apache.camel.util.ObjectHelper;
title = "OpenAI",
syntax = "openai:operation",
category = { Category.AI },
- producerOnly = true)
+ producerOnly = true,
+ headersClass = OpenAIConstants.class)
public class OpenAIEndpoint extends DefaultEndpoint {
@UriPath
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
index 4b3f5c9ae3d5..b68204ed35c8 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
@@ -457,6 +457,19 @@ public interface OpenAIEndpointBuilderFactory {
}
public interface OpenAIBuilders {
+ /**
+ * OpenAI (camel-openai)
+ * OpenAI endpoint for chat completion.
+ *
+ * Category: ai
+ * Since: 4.17
+ * Maven coordinates: org.apache.camel:camel-openai
+ *
+ * @return the dsl builder for the headers' name.
+ */
+ default OpenAIHeaderNameBuilder openai() {
+ return OpenAIHeaderNameBuilder.INSTANCE;
+ }
/**
* OpenAI (camel-openai)
* OpenAI endpoint for chat completion.
@@ -501,6 +514,227 @@ public interface OpenAIEndpointBuilderFactory {
}
}
+ /**
+ * The builder of headers' name for the OpenAI component.
+ */
+ public static class OpenAIHeaderNameBuilder {
+ /**
+ * The internal instance of the builder used to access to all the
+ * methods representing the name of headers.
+ */
+ private static final OpenAIHeaderNameBuilder INSTANCE = new
OpenAIHeaderNameBuilder();
+
+ /**
+ * The user message to send to the OpenAI chat completion API.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIUserMessage}.
+ */
+ public String openAIUserMessage() {
+ return "CamelOpenAIUserMessage";
+ }
+ /**
+ * The system message to provide context and instructions to the model.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAISystemMessage}.
+ */
+ public String openAISystemMessage() {
+ return "CamelOpenAISystemMessage";
+ }
+ /**
+ * The developer message to provide additional instructions to the
+ * model.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIDeveloperMessage}.
+ */
+ public String openAIDeveloperMessage() {
+ return "CamelOpenAIDeveloperMessage";
+ }
+ /**
+ * The model to use for chat completion (e.g., gpt-4, gpt-3.5-turbo).
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIModel}.
+ */
+ public String openAIModel() {
+ return "CamelOpenAIModel";
+ }
+ /**
+ * Controls randomness in the response. Higher values (e.g., 0.8) make
+ * output more random, lower values (e.g., 0.2) make it more
+ * deterministic.
+ *
+ * The option is a: {@code Double} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAITemperature}.
+ */
+ public String openAITemperature() {
+ return "CamelOpenAITemperature";
+ }
+ /**
+ * An alternative to temperature for controlling randomness. Uses
+ * nucleus sampling where the model considers tokens with top_p
+ * probability mass.
+ *
+ * The option is a: {@code Double} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAITopP}.
+ */
+ public String openAITopP() {
+ return "CamelOpenAITopP";
+ }
+ /**
+ * The maximum number of tokens to generate in the completion.
+ *
+ * The option is a: {@code Integer} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIMaxTokens}.
+ */
+ public String openAIMaxTokens() {
+ return "CamelOpenAIMaxTokens";
+ }
+ /**
+ * Whether to stream the response back incrementally.
+ *
+ * The option is a: {@code Boolean} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIStreaming}.
+ */
+ public String openAIStreaming() {
+ return "CamelOpenAIStreaming";
+ }
+ /**
+ * The Java class to use for structured output parsing.
+ *
+ * The option is a: {@code Class} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIOutputClass}.
+ */
+ public String openAIOutputClass() {
+ return "CamelOpenAIOutputClass";
+ }
+ /**
+ * The JSON schema to use for structured output validation.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIJsonSchema}.
+ */
+ public String openAIJsonSchema() {
+ return "CamelOpenAIJsonSchema";
+ }
+ /**
+ * The model used for the completion response.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIResponseModel}.
+ */
+ public String openAIResponseModel() {
+ return "CamelOpenAIResponseModel";
+ }
+ /**
+ * The unique identifier for the completion response.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIResponseId}.
+ */
+ public String openAIResponseId() {
+ return "CamelOpenAIResponseId";
+ }
+ /**
+ * The reason the completion finished (e.g., stop, length,
+ * content_filter).
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIFinishReason}.
+ */
+ public String openAIFinishReason() {
+ return "CamelOpenAIFinishReason";
+ }
+ /**
+ * The number of tokens used in the prompt.
+ *
+ * The option is a: {@code Integer} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIPromptTokens}.
+ */
+ public String openAIPromptTokens() {
+ return "CamelOpenAIPromptTokens";
+ }
+ /**
+ * The number of tokens used in the completion.
+ *
+ * The option is a: {@code Integer} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAICompletionTokens}.
+ */
+ public String openAICompletionTokens() {
+ return "CamelOpenAICompletionTokens";
+ }
+ /**
+ * The total number of tokens used (prompt completion).
+ *
+ * The option is a: {@code Integer} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAITotalTokens}.
+ */
+ public String openAITotalTokens() {
+ return "CamelOpenAITotalTokens";
+ }
+ /**
+ * The complete OpenAI response object.
+ *
+ * The option is a: {@code com.openai.models.ChatCompletion} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code OpenAIResponse}.
+ */
+ public String openAIResponse() {
+ return "CamelOpenAIResponse";
+ }
+ }
static OpenAIEndpointBuilder endpointBuilder(String componentName, String
path) {
class OpenAIEndpointBuilderImpl extends AbstractEndpointBuilder
implements OpenAIEndpointBuilder, AdvancedOpenAIEndpointBuilder {
public OpenAIEndpointBuilderImpl(String path) {