Skip to content

Commit 2102d96

Browse files
chore(api): remove unsupported property
1 parent cb5c638 commit 2102d96

File tree

6 files changed

+17
-118
lines changed

6 files changed

+17
-118
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 86
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-cca460eaf5cc13e9d6e5293eb97aac53d66dc1385c691f74b768c97d165b6e8b.yml
3-
openapi_spec_hash: 9ec43d443b3dd58ca5aa87eb0a7eb49f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a473967d1766dc155994d932fbc4a5bcbd1c140a37c20d0a4065e1bf0640536d.yml
3+
openapi_spec_hash: 67cdc62b0d6c8b1de29b7dc54b265749
44
config_hash: e74d6791681e3af1b548748ff47a22c2

openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import com.openai.core.ExcludeMissing
2020
import com.openai.core.JsonField
2121
import com.openai.core.JsonMissing
2222
import com.openai.core.JsonValue
23-
import com.openai.core.checkKnown
2423
import com.openai.core.checkRequired
2524
import com.openai.core.getOrThrow
26-
import com.openai.core.toImmutable
2725
import com.openai.errors.OpenAIInvalidDataException
2826
import java.util.Collections
2927
import java.util.Objects
@@ -525,18 +523,14 @@ private constructor(
525523
private constructor(
526524
private val query: JsonField<String>,
527525
private val type: JsonValue,
528-
private val domains: JsonField<List<String>>,
529526
private val additionalProperties: MutableMap<String, JsonValue>,
530527
) {
531528

532529
@JsonCreator
533530
private constructor(
534531
@JsonProperty("query") @ExcludeMissing query: JsonField<String> = JsonMissing.of(),
535532
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
536-
@JsonProperty("domains")
537-
@ExcludeMissing
538-
domains: JsonField<List<String>> = JsonMissing.of(),
539-
) : this(query, type, domains, mutableMapOf())
533+
) : this(query, type, mutableMapOf())
540534

541535
/**
542536
* The search query.
@@ -560,30 +554,13 @@ private constructor(
560554
*/
561555
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
562556

563-
/**
564-
* Domains to restrict the search or domains where results were found.
565-
*
566-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if
567-
* the server responded with an unexpected value).
568-
*/
569-
fun domains(): Optional<List<String>> = domains.getOptional("domains")
570-
571557
/**
572558
* Returns the raw JSON value of [query].
573559
*
574560
* Unlike [query], this method doesn't throw if the JSON field has an unexpected type.
575561
*/
576562
@JsonProperty("query") @ExcludeMissing fun _query(): JsonField<String> = query
577563

578-
/**
579-
* Returns the raw JSON value of [domains].
580-
*
581-
* Unlike [domains], this method doesn't throw if the JSON field has an unexpected type.
582-
*/
583-
@JsonProperty("domains")
584-
@ExcludeMissing
585-
fun _domains(): JsonField<List<String>> = domains
586-
587564
@JsonAnySetter
588565
private fun putAdditionalProperty(key: String, value: JsonValue) {
589566
additionalProperties.put(key, value)
@@ -614,14 +591,12 @@ private constructor(
614591

615592
private var query: JsonField<String>? = null
616593
private var type: JsonValue = JsonValue.from("search")
617-
private var domains: JsonField<MutableList<String>>? = null
618594
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
619595

620596
@JvmSynthetic
621597
internal fun from(search: Search) = apply {
622598
query = search.query
623599
type = search.type
624-
domains = search.domains.map { it.toMutableList() }
625600
additionalProperties = search.additionalProperties.toMutableMap()
626601
}
627602

@@ -651,32 +626,6 @@ private constructor(
651626
*/
652627
fun type(type: JsonValue) = apply { this.type = type }
653628

654-
/** Domains to restrict the search or domains where results were found. */
655-
fun domains(domains: List<String>) = domains(JsonField.of(domains))
656-
657-
/**
658-
* Sets [Builder.domains] to an arbitrary JSON value.
659-
*
660-
* You should usually call [Builder.domains] with a well-typed `List<String>` value
661-
* instead. This method is primarily for setting the field to an undocumented or not
662-
* yet supported value.
663-
*/
664-
fun domains(domains: JsonField<List<String>>) = apply {
665-
this.domains = domains.map { it.toMutableList() }
666-
}
667-
668-
/**
669-
* Adds a single [String] to [domains].
670-
*
671-
* @throws IllegalStateException if the field was previously set to a non-list.
672-
*/
673-
fun addDomain(domain: String) = apply {
674-
domains =
675-
(domains ?: JsonField.of(mutableListOf())).also {
676-
checkKnown("domains", it).add(domain)
677-
}
678-
}
679-
680629
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
681630
this.additionalProperties.clear()
682631
putAllAdditionalProperties(additionalProperties)
@@ -712,12 +661,7 @@ private constructor(
712661
* @throws IllegalStateException if any required field is unset.
713662
*/
714663
fun build(): Search =
715-
Search(
716-
checkRequired("query", query),
717-
type,
718-
(domains ?: JsonMissing.of()).map { it.toImmutable() },
719-
additionalProperties.toMutableMap(),
720-
)
664+
Search(checkRequired("query", query), type, additionalProperties.toMutableMap())
721665
}
722666

723667
private var validated: Boolean = false
@@ -733,7 +677,6 @@ private constructor(
733677
throw OpenAIInvalidDataException("'type' is invalid, received $it")
734678
}
735679
}
736-
domains()
737680
validated = true
738681
}
739682

@@ -754,25 +697,24 @@ private constructor(
754697
@JvmSynthetic
755698
internal fun validity(): Int =
756699
(if (query.asKnown().isPresent) 1 else 0) +
757-
type.let { if (it == JsonValue.from("search")) 1 else 0 } +
758-
(domains.asKnown().getOrNull()?.size ?: 0)
700+
type.let { if (it == JsonValue.from("search")) 1 else 0 }
759701

760702
override fun equals(other: Any?): Boolean {
761703
if (this === other) {
762704
return true
763705
}
764706

765-
return /* spotless:off */ other is Search && query == other.query && type == other.type && domains == other.domains && additionalProperties == other.additionalProperties /* spotless:on */
707+
return /* spotless:off */ other is Search && query == other.query && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
766708
}
767709

768710
/* spotless:off */
769-
private val hashCode: Int by lazy { Objects.hash(query, type, domains, additionalProperties) }
711+
private val hashCode: Int by lazy { Objects.hash(query, type, additionalProperties) }
770712
/* spotless:on */
771713

772714
override fun hashCode(): Int = hashCode
773715

774716
override fun toString() =
775-
"Search{query=$query, type=$type, domains=$domains, additionalProperties=$additionalProperties}"
717+
"Search{query=$query, type=$type, additionalProperties=$additionalProperties}"
776718
}
777719

778720
/** Action type "open_page" - Opens a specific URL from search results. */

openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionWebSearchTest.kt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,15 @@ internal class ResponseFunctionWebSearchTest {
1414
val responseFunctionWebSearch =
1515
ResponseFunctionWebSearch.builder()
1616
.id("id")
17-
.action(
18-
ResponseFunctionWebSearch.Action.Search.builder()
19-
.query("query")
20-
.addDomain("string")
21-
.build()
22-
)
17+
.searchAction("query")
2318
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
2419
.build()
2520

2621
assertThat(responseFunctionWebSearch.id()).isEqualTo("id")
2722
assertThat(responseFunctionWebSearch.action())
2823
.isEqualTo(
2924
ResponseFunctionWebSearch.Action.ofSearch(
30-
ResponseFunctionWebSearch.Action.Search.builder()
31-
.query("query")
32-
.addDomain("string")
33-
.build()
25+
ResponseFunctionWebSearch.Action.Search.builder().query("query").build()
3426
)
3527
)
3628
assertThat(responseFunctionWebSearch.status())
@@ -43,12 +35,7 @@ internal class ResponseFunctionWebSearchTest {
4335
val responseFunctionWebSearch =
4436
ResponseFunctionWebSearch.builder()
4537
.id("id")
46-
.action(
47-
ResponseFunctionWebSearch.Action.Search.builder()
48-
.query("query")
49-
.addDomain("string")
50-
.build()
51-
)
38+
.searchAction("query")
5239
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
5340
.build()
5441

openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,7 @@ internal class ResponseInputItemTest {
471471
val webSearchCall =
472472
ResponseFunctionWebSearch.builder()
473473
.id("id")
474-
.action(
475-
ResponseFunctionWebSearch.Action.Search.builder()
476-
.query("query")
477-
.addDomain("string")
478-
.build()
479-
)
474+
.searchAction("query")
480475
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
481476
.build()
482477

@@ -510,12 +505,7 @@ internal class ResponseInputItemTest {
510505
ResponseInputItem.ofWebSearchCall(
511506
ResponseFunctionWebSearch.builder()
512507
.id("id")
513-
.action(
514-
ResponseFunctionWebSearch.Action.Search.builder()
515-
.query("query")
516-
.addDomain("string")
517-
.build()
518-
)
508+
.searchAction("query")
519509
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
520510
.build()
521511
)

openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,7 @@ internal class ResponseItemTest {
405405
val webSearchCall =
406406
ResponseFunctionWebSearch.builder()
407407
.id("id")
408-
.action(
409-
ResponseFunctionWebSearch.Action.Search.builder()
410-
.query("query")
411-
.addDomain("string")
412-
.build()
413-
)
408+
.searchAction("query")
414409
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
415410
.build()
416411

@@ -441,12 +436,7 @@ internal class ResponseItemTest {
441436
ResponseItem.ofWebSearchCall(
442437
ResponseFunctionWebSearch.builder()
443438
.id("id")
444-
.action(
445-
ResponseFunctionWebSearch.Action.Search.builder()
446-
.query("query")
447-
.addDomain("string")
448-
.build()
449-
)
439+
.searchAction("query")
450440
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
451441
.build()
452442
)

openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,7 @@ internal class ResponseOutputItemTest {
237237
val webSearchCall =
238238
ResponseFunctionWebSearch.builder()
239239
.id("id")
240-
.action(
241-
ResponseFunctionWebSearch.Action.Search.builder()
242-
.query("query")
243-
.addDomain("string")
244-
.build()
245-
)
240+
.searchAction("query")
246241
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
247242
.build()
248243

@@ -269,12 +264,7 @@ internal class ResponseOutputItemTest {
269264
ResponseOutputItem.ofWebSearchCall(
270265
ResponseFunctionWebSearch.builder()
271266
.id("id")
272-
.action(
273-
ResponseFunctionWebSearch.Action.Search.builder()
274-
.query("query")
275-
.addDomain("string")
276-
.build()
277-
)
267+
.searchAction("query")
278268
.status(ResponseFunctionWebSearch.Status.IN_PROGRESS)
279269
.build()
280270
)

0 commit comments

Comments
 (0)