Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.17.0"
".": "0.18.0"
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.18.0 (2025-01-29)

Full Changelog: [v0.17.0...v0.18.0](https://github.com/openai/openai-java/compare/v0.17.0...v0.18.0)

### Features

* **client:** helpers for discriminated union variants with one required prop ([#182](https://github.com/openai/openai-java/issues/182)) ([ec756b9](https://github.com/openai/openai-java/commit/ec756b9788629dfc36bb56d59d9f17f4d0d8cc35))


### Chores

* **internal:** improve `RetryingHttpClientTest` ([#180](https://github.com/openai/openai-java/issues/180)) ([b7ebe5d](https://github.com/openai/openai-java/commit/b7ebe5d44b2797618905614b51a27b73906e4271))
* **internal:** simplify object construction ([#183](https://github.com/openai/openai-java/issues/183)) ([3d5a59d](https://github.com/openai/openai-java/commit/3d5a59dccc425e351a365f9dbdf2ae52244086ae))


### Documentation

* simpliy param construction ([2c2ccbc](https://github.com/openai/openai-java/commit/2c2ccbc83a053e525ad0d8df1506de5be4fda46c))

## 0.17.0 (2025-01-29)

Full Changelog: [v0.16.0...v0.17.0](https://github.com/openai/openai-java/compare/v0.16.0...v0.17.0)
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.17.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.17.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.17.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.18.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.18.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.18.0)

<!-- x-release-please-end -->

Expand All @@ -25,7 +25,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
### Gradle

```kotlin
implementation("com.openai:openai-java:0.17.0")
implementation("com.openai:openai-java:0.18.0")
```

### Maven
Expand All @@ -34,7 +34,7 @@ implementation("com.openai:openai-java:0.17.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>0.17.0</version>
<version>0.18.0</version>
</dependency>
```

Expand Down Expand Up @@ -93,13 +93,10 @@ To create a new chat completion, first use the `ChatCompletionCreateParams` buil
```java
import com.openai.models.ChatCompletion;
import com.openai.models.ChatCompletionCreateParams;
import com.openai.models.ChatCompletionUserMessageParam;
import com.openai.models.ChatModel;

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.addMessage(ChatCompletionUserMessageParam.builder()
.content("Say this is a test")
.build())
.addUserMessage("Say this is a test")
.model(ChatModel.O1)
.build();
ChatCompletion chatCompletion = client.chat().completions().create(params);
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.openai"
version = "0.17.0" // x-release-please-version
version = "0.18.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ private constructor(
*/
fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))

/**
* 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 addFunctionTool(function: FunctionDefinition) =
addTool(FunctionTool.builder().function(function).build())

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,13 @@ private constructor(
*/
fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))

/**
* 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 addFunctionTool(function: FunctionDefinition) =
addTool(FunctionTool.builder().function(function).build())

/**
* 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
Expand Down Expand Up @@ -1205,6 +1212,12 @@ private constructor(
*/
fun addTool(function: FunctionTool) = apply { body.addTool(function) }

/**
* 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 addFunctionTool(function: FunctionDefinition) = apply { body.addFunctionTool(function) }

/**
* 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
Expand Down Expand Up @@ -1941,6 +1954,15 @@ private constructor(
fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))

/**
* The chunking strategy used to chunk the file(s). If not set, will use the
* `auto` strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) =
chunkingStrategy(
StaticFileChunkingStrategyObjectParam.builder().static_(static_).build()
)

/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
* add to the vector store. There can be a maximum of 10000 files in a vector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,13 @@ private constructor(
*/
fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))

/**
* 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 addFunctionTool(function: FunctionDefinition) =
addTool(FunctionTool.builder().function(function).build())

/**
* 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
Expand Down Expand Up @@ -1203,6 +1210,12 @@ private constructor(
*/
fun addTool(function: FunctionTool) = apply { body.addTool(function) }

/**
* 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 addFunctionTool(function: FunctionDefinition) = apply { body.addFunctionTool(function) }

/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3553,6 +3553,17 @@ private constructor(
fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))

/**
* The chunking strategy used to chunk the file(s). If not set, will use the
* `auto` strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) =
chunkingStrategy(
StaticFileChunkingStrategyObjectParam.builder()
.static_(static_)
.build()
)

/**
* A list of [file](https://platform.openai.com/docs/api-reference/files)
* IDs to add to the vector store. There can be a maximum of 10000 files in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,15 @@ private constructor(
fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))

/**
* The chunking strategy used to chunk the file(s). If not set, will use the
* `auto` strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) =
chunkingStrategy(
StaticFileChunkingStrategyObjectParam.builder().static_(static_).build()
)

/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
* add to the vector store. There can be a maximum of 10000 files in a vector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,13 @@ private constructor(
*/
fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addFunctionTool(function: FunctionDefinition) =
addTool(FunctionTool.builder().function(function).build())

/**
* 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
Expand Down Expand Up @@ -1885,6 +1892,12 @@ private constructor(
*/
fun addTool(function: FunctionTool) = apply { body.addTool(function) }

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addFunctionTool(function: FunctionDefinition) = apply { body.addFunctionTool(function) }

/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ private constructor(
fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))

/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) =
chunkingStrategy(
StaticFileChunkingStrategyObjectParam.builder().static_(static_).build()
)

/** The expiration policy for a vector store. */
fun expiresAfter(expiresAfter: ExpiresAfter) = expiresAfter(JsonField.of(expiresAfter))

Expand Down Expand Up @@ -384,6 +393,14 @@ private constructor(
body.chunkingStrategy(static_)
}

/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) = apply {
body.staticChunkingStrategy(static_)
}

/** The expiration policy for a vector store. */
fun expiresAfter(expiresAfter: ExpiresAfter) = apply { body.expiresAfter(expiresAfter) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ private constructor(
fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))

/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) =
chunkingStrategy(
StaticFileChunkingStrategyObjectParam.builder().static_(static_).build()
)

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down Expand Up @@ -340,6 +349,14 @@ private constructor(
body.chunkingStrategy(static_)
}

/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) = apply {
body.staticChunkingStrategy(static_)
}

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
body.additionalProperties(additionalBodyProperties)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ private constructor(
fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))

/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) =
chunkingStrategy(
StaticFileChunkingStrategyObjectParam.builder().static_(static_).build()
)

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down Expand Up @@ -317,6 +326,14 @@ private constructor(
body.chunkingStrategy(static_)
}

/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
fun staticChunkingStrategy(static_: StaticFileChunkingStrategy) = apply {
body.staticChunkingStrategy(static_)
}

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
body.additionalProperties(additionalBodyProperties)
}
Expand Down
Loading