diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 091cfb127..f7014c353 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.10.0"
+ ".": "0.11.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7fede91ab..12ea0de21 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.11.0 (2025-01-08)
+
+Full Changelog: [v0.10.0...v0.11.0](https://github.com/openai/openai-java/compare/v0.10.0...v0.11.0)
+
+### Features
+
+* **client:** add more builder convenience methods for lists ([#96](https://github.com/openai/openai-java/issues/96)) ([9ee703b](https://github.com/openai/openai-java/commit/9ee703b13e8c467a71e7787d420a131bc1910e4f))
+
+
+### Documentation
+
+* **readme:** fix misplaced period ([#94](https://github.com/openai/openai-java/issues/94)) ([c6242ba](https://github.com/openai/openai-java/commit/c6242bad2b917fb419d9a69ad65cebbda9b56b51))
+
## 0.10.0 (2025-01-08)
Full Changelog: [v0.9.1...v0.10.0](https://github.com/openai/openai-java/compare/v0.9.1...v0.10.0)
diff --git a/README.md b/README.md
index 20818e0aa..65bd21338 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/0.10.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/0.11.0)
@@ -32,7 +32,7 @@ The REST API documentation can be foundĀ on [platform.openai.com](https://platfo
```kotlin
-implementation("com.openai:openai-java:0.10.0")
+implementation("com.openai:openai-java:0.11.0")
```
#### Maven
@@ -41,7 +41,7 @@ implementation("com.openai:openai-java:0.10.0")
com.openai
openai-java
- 0.10.0
+ 0.11.0
```
@@ -417,7 +417,7 @@ $ export OPENAI_LOG=debug
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
-1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
+1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
2. Changes that we do not expect to impact the vast majority of users in practice.
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
diff --git a/build.gradle.kts b/build.gradle.kts
index f901fcc35..c8bce5fe2 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,7 +4,7 @@ plugins {
allprojects {
group = "com.openai"
- version = "0.10.0" // x-release-please-version
+ version = "0.11.0" // x-release-please-version
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt b/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
index 4bd3cc004..9a83bf522 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
@@ -405,6 +405,27 @@ private constructor(
}
}
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(functionTool: FunctionTool) =
+ addTool(AssistantTool.ofFunctionTool(functionTool))
+
/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt
index f6148ef4c..a6a3427f0 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt
@@ -699,6 +699,27 @@ constructor(
}
}
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(functionTool: FunctionTool) =
+ addTool(AssistantTool.ofFunctionTool(functionTool))
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
@@ -1041,6 +1062,26 @@ constructor(
*/
fun addTool(tool: AssistantTool) = apply { body.addTool(tool) }
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
+ body.addTool(codeInterpreterTool)
+ }
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt
index 4a0f70d6b..e7fd3ae87 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt
@@ -701,6 +701,27 @@ constructor(
}
}
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(functionTool: FunctionTool) =
+ addTool(AssistantTool.ofFunctionTool(functionTool))
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
@@ -1039,6 +1060,26 @@ constructor(
*/
fun addTool(tool: AssistantTool) = apply { body.addTool(tool) }
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
+ body.addTool(codeInterpreterTool)
+ }
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+
+ /**
+ * A list of tool enabled on the assistant. There can be a maximum of 128 tools per
+ * assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt
index 4360aef30..66febe860 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt
@@ -1083,6 +1083,26 @@ constructor(
}
}
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying
+ * the behavior on a per-run basis.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying
+ * the behavior on a per-run basis.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) =
+ addTool(Tool.ofFileSearchTool(fileSearchTool))
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying
+ * the behavior on a per-run basis.
+ */
+ fun addTool(functionTool: FunctionTool) = addTool(Tool.ofFunctionTool(functionTool))
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
@@ -1608,6 +1628,26 @@ constructor(
*/
fun addTool(tool: Tool) = apply { body.addTool(tool) }
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying the
+ * behavior on a per-run basis.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
+ body.addTool(codeInterpreterTool)
+ }
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying the
+ * behavior on a per-run basis.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying the
+ * behavior on a per-run basis.
+ */
+ fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
@@ -2476,6 +2516,14 @@ constructor(
}
}
+ /** The tools to add this file to. */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /** The tools to add this file to. */
+ fun addTool(fileSearch: Tool.FileSearch) =
+ addTool(Tool.ofFileSearch(fileSearch))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt
index 600b8b7a8..6f0ea5a49 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt
@@ -966,6 +966,13 @@ constructor(
}
}
+ /** The tools to add this file to. */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /** The tools to add this file to. */
+ fun addTool(fileSearch: Tool.FileSearch) = addTool(Tool.ofFileSearch(fileSearch))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt
index c8cf7f412..79fdee0c7 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt
@@ -801,6 +801,13 @@ constructor(
}
}
+ /** The tools to add this file to. */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /** The tools to add this file to. */
+ fun addTool(fileSearch: Tool.FileSearch) = addTool(Tool.ofFileSearch(fileSearch))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt
index 709594b80..9aac95b9e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt
@@ -1140,6 +1140,27 @@ constructor(
}
}
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying
+ * the behavior on a per-run basis.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying
+ * the behavior on a per-run basis.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying
+ * the behavior on a per-run basis.
+ */
+ fun addTool(functionTool: FunctionTool) =
+ addTool(AssistantTool.ofFunctionTool(functionTool))
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
@@ -1724,6 +1745,26 @@ constructor(
*/
fun addTool(tool: AssistantTool) = apply { body.addTool(tool) }
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying the
+ * behavior on a per-run basis.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
+ body.addTool(codeInterpreterTool)
+ }
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying the
+ * behavior on a per-run basis.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+
+ /**
+ * Override the tools the assistant can use for this run. This is useful for modifying the
+ * behavior on a per-run basis.
+ */
+ fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
@@ -2387,6 +2428,13 @@ constructor(
}
}
+ /** The tools to add this file to. */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /** The tools to add this file to. */
+ fun addTool(fileSearch: Tool.FileSearch) = addTool(Tool.ofFileSearch(fileSearch))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt
index a7c221c74..12c3aba7d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt
@@ -1356,6 +1356,100 @@ constructor(
}
}
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(
+ chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam
+ ) =
+ addMessage(
+ ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam(
+ chatCompletionDeveloperMessageParam
+ )
+ )
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam) =
+ addMessage(
+ ChatCompletionMessageParam.ofChatCompletionSystemMessageParam(
+ chatCompletionSystemMessageParam
+ )
+ )
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionUserMessageParam: ChatCompletionUserMessageParam) =
+ addMessage(
+ ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
+ chatCompletionUserMessageParam
+ )
+ )
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(
+ chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam
+ ) =
+ addMessage(
+ ChatCompletionMessageParam.ofChatCompletionAssistantMessageParam(
+ chatCompletionAssistantMessageParam
+ )
+ )
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionToolMessageParam: ChatCompletionToolMessageParam) =
+ addMessage(
+ ChatCompletionMessageParam.ofChatCompletionToolMessageParam(
+ chatCompletionToolMessageParam
+ )
+ )
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam) =
+ addMessage(
+ ChatCompletionMessageParam.ofChatCompletionFunctionMessageParam(
+ chatCompletionFunctionMessageParam
+ )
+ )
+
/**
* ID of the model to use. See the
* [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
@@ -2378,6 +2472,81 @@ constructor(
*/
fun addMessage(message: ChatCompletionMessageParam) = apply { body.addMessage(message) }
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam) =
+ apply {
+ body.addMessage(chatCompletionDeveloperMessageParam)
+ }
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam) = apply {
+ body.addMessage(chatCompletionSystemMessageParam)
+ }
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionUserMessageParam: ChatCompletionUserMessageParam) = apply {
+ body.addMessage(chatCompletionUserMessageParam)
+ }
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam) =
+ apply {
+ body.addMessage(chatCompletionAssistantMessageParam)
+ }
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionToolMessageParam: ChatCompletionToolMessageParam) = apply {
+ body.addMessage(chatCompletionToolMessageParam)
+ }
+
+ /**
+ * A list of messages comprising the conversation so far. Depending on the
+ * [model](https://platform.openai.com/docs/models) you use, different message types
+ * (modalities) are supported, like
+ * [text](https://platform.openai.com/docs/guides/text-generation),
+ * [images](https://platform.openai.com/docs/guides/vision), and
+ * [audio](https://platform.openai.com/docs/guides/audio).
+ */
+ fun addMessage(chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam) =
+ apply {
+ body.addMessage(chatCompletionFunctionMessageParam)
+ }
+
/**
* ID of the model to use. See the
* [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt
index 1805f1b7f..b56b77ea4 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt
@@ -269,6 +269,20 @@ private constructor(
}
}
+ /**
+ * The outputs from the Code Interpreter tool call. Code Interpreter can output one or
+ * more items, including text (`logs`) or images (`image`). Each of these are
+ * represented by a different object type.
+ */
+ fun addOutput(logs: Output.LogsOutput) = addOutput(Output.ofLogs(logs))
+
+ /**
+ * The outputs from the Code Interpreter tool call. Code Interpreter can output one or
+ * more items, including text (`logs`) or images (`image`). Each of these are
+ * represented by a different object type.
+ */
+ fun addOutput(image: Output.ImageOutput) = addOutput(Output.ofImage(image))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt
index 6ee080025..74637564e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt
@@ -338,6 +338,22 @@ private constructor(
}
}
+ /**
+ * The outputs from the Code Interpreter tool call. Code Interpreter can output one or
+ * more items, including text (`logs`) or images (`image`). Each of these are
+ * represented by a different object type.
+ */
+ fun addOutput(codeInterpreterLogs: CodeInterpreterLogs) =
+ addOutput(Output.ofCodeInterpreterLogs(codeInterpreterLogs))
+
+ /**
+ * The outputs from the Code Interpreter tool call. Code Interpreter can output one or
+ * more items, including text (`logs`) or images (`image`). Each of these are
+ * represented by a different object type.
+ */
+ fun addOutput(codeInterpreterOutputImage: CodeInterpreterOutputImage) =
+ addOutput(Output.ofCodeInterpreterOutputImage(codeInterpreterOutputImage))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Message.kt b/openai-java-core/src/main/kotlin/com/openai/models/Message.kt
index 30591d48f..da3bf8ebd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Message.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Message.kt
@@ -356,6 +356,22 @@ private constructor(
}
}
+ /** The content of the message in array of text and/or images. */
+ fun addContent(imageFileContentBlock: ImageFileContentBlock) =
+ addContent(MessageContent.ofImageFileContentBlock(imageFileContentBlock))
+
+ /** The content of the message in array of text and/or images. */
+ fun addContent(imageUrlContentBlock: ImageUrlContentBlock) =
+ addContent(MessageContent.ofImageUrlContentBlock(imageUrlContentBlock))
+
+ /** The content of the message in array of text and/or images. */
+ fun addContent(textContentBlock: TextContentBlock) =
+ addContent(MessageContent.ofTextContentBlock(textContentBlock))
+
+ /** The content of the message in array of text and/or images. */
+ fun addContent(refusalContentBlock: RefusalContentBlock) =
+ addContent(MessageContent.ofRefusalContentBlock(refusalContentBlock))
+
/** The Unix timestamp (in seconds) for when the message was created. */
fun createdAt(createdAt: Long) = createdAt(JsonField.of(createdAt))
@@ -584,6 +600,14 @@ private constructor(
}
}
+ /** The tools to add this file to. */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /** The tools to add this file to. */
+ fun addTool(assistantToolsFileSearchTypeOnly: Tool.AssistantToolsFileSearchTypeOnly) =
+ addTool(Tool.ofAssistantToolsFileSearchTypeOnly(assistantToolsFileSearchTypeOnly))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt
index 749b16862..3e2f35200 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt
@@ -101,6 +101,22 @@ private constructor(
}
}
+ /** The content of the message in array of text and/or images. */
+ fun addContent(imageFileDeltaBlock: ImageFileDeltaBlock) =
+ addContent(MessageContentDelta.ofImageFileDeltaBlock(imageFileDeltaBlock))
+
+ /** The content of the message in array of text and/or images. */
+ fun addContent(textDeltaBlock: TextDeltaBlock) =
+ addContent(MessageContentDelta.ofTextDeltaBlock(textDeltaBlock))
+
+ /** The content of the message in array of text and/or images. */
+ fun addContent(refusalDeltaBlock: RefusalDeltaBlock) =
+ addContent(MessageContentDelta.ofRefusalDeltaBlock(refusalDeltaBlock))
+
+ /** The content of the message in array of text and/or images. */
+ fun addContent(imageUrlDeltaBlock: ImageUrlDeltaBlock) =
+ addContent(MessageContentDelta.ofImageUrlDeltaBlock(imageUrlDeltaBlock))
+
/** The entity that produced the message. One of `user` or `assistant`. */
fun role(role: Role) = role(JsonField.of(role))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Run.kt b/openai-java-core/src/main/kotlin/com/openai/models/Run.kt
index 453956e7f..3439a2e04 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Run.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Run.kt
@@ -961,6 +961,27 @@ private constructor(
}
}
+ /**
+ * The list of tools that the
+ * [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
+ */
+ fun addTool(codeInterpreterTool: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+
+ /**
+ * The list of tools that the
+ * [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
+ */
+ fun addTool(fileSearchTool: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+
+ /**
+ * The list of tools that the
+ * [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run.
+ */
+ fun addTool(functionTool: FunctionTool) =
+ addTool(AssistantTool.ofFunctionTool(functionTool))
+
/**
* Controls for how a thread will be truncated prior to the run. Use this to control the
* intial context window of the run.
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Text.kt b/openai-java-core/src/main/kotlin/com/openai/models/Text.kt
index 746e13a98..c762222db 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Text.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Text.kt
@@ -91,6 +91,12 @@ private constructor(
}
}
+ fun addAnnotation(fileCitationAnnotation: FileCitationAnnotation) =
+ addAnnotation(Annotation.ofFileCitationAnnotation(fileCitationAnnotation))
+
+ fun addAnnotation(filePathAnnotation: FilePathAnnotation) =
+ addAnnotation(Annotation.ofFilePathAnnotation(filePathAnnotation))
+
/** The data that makes up the text. */
fun value(value: String) = value(JsonField.of(value))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt
index df7ca71b2..15487d569 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt
@@ -93,6 +93,14 @@ private constructor(
}
}
+ fun addAnnotation(fileCitationDeltaAnnotation: FileCitationDeltaAnnotation) =
+ addAnnotation(
+ AnnotationDelta.ofFileCitationDeltaAnnotation(fileCitationDeltaAnnotation)
+ )
+
+ fun addAnnotation(filePathDeltaAnnotation: FilePathDeltaAnnotation) =
+ addAnnotation(AnnotationDelta.ofFilePathDeltaAnnotation(filePathDeltaAnnotation))
+
/** The data that makes up the text. */
fun value(value: String) = value(JsonField.of(value))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt
index cedd0e7a3..0c4d10167 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt
@@ -122,6 +122,27 @@ private constructor(
}
}
+ /**
+ * An array of tool calls the run step was involved in. These can be associated with one of
+ * three types of tools: `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addToolCall(codeInterpreterToolCallDelta: CodeInterpreterToolCallDelta) =
+ addToolCall(ToolCallDelta.ofCodeInterpreterToolCallDelta(codeInterpreterToolCallDelta))
+
+ /**
+ * An array of tool calls the run step was involved in. These can be associated with one of
+ * three types of tools: `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addToolCall(fileSearchToolCallDelta: FileSearchToolCallDelta) =
+ addToolCall(ToolCallDelta.ofFileSearchToolCallDelta(fileSearchToolCallDelta))
+
+ /**
+ * An array of tool calls the run step was involved in. These can be associated with one of
+ * three types of tools: `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addToolCall(functionToolCallDelta: FunctionToolCallDelta) =
+ addToolCall(ToolCallDelta.ofFunctionToolCallDelta(functionToolCallDelta))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt
index 0a8de13a9..6e50d167b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt
@@ -114,6 +114,27 @@ private constructor(
}
}
+ /**
+ * An array of tool calls the run step was involved in. These can be associated with one of
+ * three types of tools: `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addToolCall(codeInterpreterToolCall: CodeInterpreterToolCall) =
+ addToolCall(ToolCall.ofCodeInterpreterToolCall(codeInterpreterToolCall))
+
+ /**
+ * An array of tool calls the run step was involved in. These can be associated with one of
+ * three types of tools: `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addToolCall(fileSearchToolCall: FileSearchToolCall) =
+ addToolCall(ToolCall.ofFileSearchToolCall(fileSearchToolCall))
+
+ /**
+ * An array of tool calls the run step was involved in. These can be associated with one of
+ * three types of tools: `code_interpreter`, `file_search`, or `function`.
+ */
+ fun addToolCall(functionToolCall: FunctionToolCall) =
+ addToolCall(ToolCall.ofFunctionToolCall(functionToolCall))
+
/** Always `tool_calls`. */
fun type(type: Type) = type(JsonField.of(type))