Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.9.0 #75

Merged
merged 7 commits into from
Jan 3, 2025
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
The table of contents is too big for display.
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.8.1"
".": "0.9.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 24
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml
configured_endpoints: 60
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-02200a58ed631064b6419711da99fefd6e97bdbbeb577a80a1a6e0c8dbcb18f5.yml
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 0.9.0 (2025-01-03)

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

### ⚠ BREAKING CHANGES

* **client:** switch query params objects to use `QueryParams` ([#64](https://github.com/openai/openai-java/issues/64))

### Features

* **client:** add beta endpoints ([#79](https://github.com/openai/openai-java/issues/79)) ([8584a20](https://github.com/openai/openai-java/commit/8584a2029ec5402b205ce485e96702da0a692b76))
* **client:** put body field in params, add more convenience methods, and add missing docs ([#77](https://github.com/openai/openai-java/issues/77)) ([0c74350](https://github.com/openai/openai-java/commit/0c74350f0e5d1f0a30ae9b27c50a306ca081b1a7))


### Chores

* bump license year ([#74](https://github.com/openai/openai-java/issues/74)) ([769175d](https://github.com/openai/openai-java/commit/769175d3c42b6679e8ea91847e1fba32ab76d9a6))


### Documentation

* add some missing javadocs ([#78](https://github.com/openai/openai-java/issues/78)) ([d153ef9](https://github.com/openai/openai-java/commit/d153ef99dff3a201bf5674ee4154f3a3d276f608))


### Refactors

* **client:** switch query params objects to use `QueryParams` ([#64](https://github.com/openai/openai-java/issues/64)) ([4e9c3eb](https://github.com/openai/openai-java/commit/4e9c3eb9351f308ed3d842bd4aa2d860c23d568e))
* **internal:** use constructor to deserialize json ([#66](https://github.com/openai/openai-java/issues/66)) ([27389cd](https://github.com/openai/openai-java/commit/27389cd377ce9a109a4aa25f78f70c36ca62de14))

## 0.8.1 (2024-12-21)

Full Changelog: [v0.8.0...v0.8.1](https://github.com/openai/openai-java/compare/v0.8.0...v0.8.1)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 OpenAI
Copyright 2025 OpenAI

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<!-- 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.8.1)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.9.0)

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

Expand All @@ -32,7 +32,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfo
<!-- x-release-please-start-version -->

```kotlin
implementation("com.openai:openai-java:0.8.1")
implementation("com.openai:openai-java:0.9.0")
```

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

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

allprojects {
group = "com.openai"
version = "0.8.1" // x-release-please-version
version = "0.9.0" // x-release-please-version
}


Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ class OpenAIOkHttpClient private constructor() {
clientOptions.azureServiceVersion(azureServiceVersion)
}

fun organization(organization: String?) = apply { clientOptions.organization(organization) }
fun organization(organization: String) = apply { clientOptions.organization(organization) }

fun project(project: String?) = apply { clientOptions.project(project) }
fun project(project: String) = apply { clientOptions.project(project) }

fun fromEnv() = apply { clientOptions.fromEnv() }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ class OpenAIOkHttpClientAsync private constructor() {
clientOptions.azureServiceVersion(azureServiceVersion)
}

fun organization(organization: String?) = apply { clientOptions.organization(organization) }
fun organization(organization: String) = apply { clientOptions.organization(organization) }

fun project(project: String?) = apply { clientOptions.project(project) }
fun project(project: String) = apply { clientOptions.project(project) }

fun fromEnv() = apply { clientOptions.fromEnv() }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.openai.client

import com.openai.services.blocking.BatchService
import com.openai.services.blocking.BetaService
import com.openai.services.blocking.ChatService
import com.openai.services.blocking.CompletionService
import com.openai.services.blocking.EmbeddingService
Expand Down Expand Up @@ -33,6 +34,8 @@ interface OpenAIClient {

fun fineTuning(): FineTuningService

fun beta(): BetaService

fun batches(): BatchService

fun uploads(): UploadService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.openai.client

import com.openai.services.async.BatchServiceAsync
import com.openai.services.async.BetaServiceAsync
import com.openai.services.async.ChatServiceAsync
import com.openai.services.async.CompletionServiceAsync
import com.openai.services.async.EmbeddingServiceAsync
Expand Down Expand Up @@ -33,6 +34,8 @@ interface OpenAIClientAsync {

fun fineTuning(): FineTuningServiceAsync

fun beta(): BetaServiceAsync

fun batches(): BatchServiceAsync

fun uploads(): UploadServiceAsync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import com.openai.core.ClientOptions
import com.openai.core.getPackageVersion
import com.openai.services.async.BatchServiceAsync
import com.openai.services.async.BatchServiceAsyncImpl
import com.openai.services.async.BetaServiceAsync
import com.openai.services.async.BetaServiceAsyncImpl
import com.openai.services.async.ChatServiceAsync
import com.openai.services.async.ChatServiceAsyncImpl
import com.openai.services.async.CompletionServiceAsync
Expand Down Expand Up @@ -69,6 +71,8 @@ constructor(
FineTuningServiceAsyncImpl(clientOptionsWithUserAgent)
}

private val beta: BetaServiceAsync by lazy { BetaServiceAsyncImpl(clientOptionsWithUserAgent) }

private val batches: BatchServiceAsync by lazy {
BatchServiceAsyncImpl(clientOptionsWithUserAgent)
}
Expand All @@ -95,6 +99,8 @@ constructor(

override fun fineTuning(): FineTuningServiceAsync = fineTuning

override fun beta(): BetaServiceAsync = beta

override fun batches(): BatchServiceAsync = batches

override fun uploads(): UploadServiceAsync = uploads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import com.openai.core.ClientOptions
import com.openai.core.getPackageVersion
import com.openai.services.blocking.BatchService
import com.openai.services.blocking.BatchServiceImpl
import com.openai.services.blocking.BetaService
import com.openai.services.blocking.BetaServiceImpl
import com.openai.services.blocking.ChatService
import com.openai.services.blocking.ChatServiceImpl
import com.openai.services.blocking.CompletionService
Expand Down Expand Up @@ -65,6 +67,8 @@ constructor(
FineTuningServiceImpl(clientOptionsWithUserAgent)
}

private val beta: BetaService by lazy { BetaServiceImpl(clientOptionsWithUserAgent) }

private val batches: BatchService by lazy { BatchServiceImpl(clientOptionsWithUserAgent) }

private val uploads: UploadService by lazy { UploadServiceImpl(clientOptionsWithUserAgent) }
Expand All @@ -87,6 +91,8 @@ constructor(

override fun fineTuning(): FineTuningService = fineTuning

override fun beta(): BetaService = beta

override fun batches(): BatchService = batches

override fun uploads(): UploadService = uploads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ private constructor(
this.azureServiceVersion = azureServiceVersion
}

fun organization(organization: String?) = apply { this.organization = organization }
fun organization(organization: String) = apply { this.organization = organization }

fun project(project: String?) = apply { this.project = project }
fun project(project: String) = apply { this.project = project }

fun fromEnv() = apply {
val openAIKey = System.getenv("OPENAI_API_KEY")
Expand Down
4 changes: 3 additions & 1 deletion openai-java-core/src/main/kotlin/com/openai/core/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ internal fun <T> List<T>.toImmutable(): List<T> =

@JvmSynthetic
internal fun <K, V> Map<K, V>.toImmutable(): Map<K, V> =
if (isEmpty()) Collections.emptyMap() else Collections.unmodifiableMap(toMap())
if (isEmpty()) immutableEmptyMap() else Collections.unmodifiableMap(toMap())

@JvmSynthetic internal fun <K, V> immutableEmptyMap(): Map<K, V> = Collections.emptyMap()

@JvmSynthetic
internal fun <K : Comparable<K>, V> SortedMap<K, V>.toImmutable(): SortedMap<K, V> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ package com.openai.errors

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.annotation.JsonCreator
import com.openai.core.ExcludeMissing
import com.openai.core.JsonValue
import com.openai.core.NoAutoDetect
import com.openai.core.immutableEmptyMap
import com.openai.core.toImmutable
import java.util.Objects

@JsonDeserialize(builder = OpenAIError.Builder::class)
@NoAutoDetect
class OpenAIError
@JsonCreator
private constructor(
@JsonAnyGetter
@ExcludeMissing
@JsonAnySetter
@get:JvmName("additionalProperties")
val additionalProperties: Map<String, JsonValue>,
val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun toBuilder() = Builder().from(this)
Expand All @@ -40,7 +44,6 @@ private constructor(
putAllAdditionalProperties(additionalProperties)
}

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Loading
Loading