Skip to content

Commit 0ea61dc

Browse files
committed
Responses API - JSON format handling for CreateModelResponseSettings (Scala 3 fix)
1 parent 85ef34f commit 0ea61dc

File tree

1 file changed

+37
-2
lines changed
  • openai-core/src/main/scala/io/cequence/openaiscala/domain/responsesapi

1 file changed

+37
-2
lines changed

openai-core/src/main/scala/io/cequence/openaiscala/domain/responsesapi/JsonFormats.scala

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,24 @@ object JsonFormats {
355355
(__ \ "stream").writeNullable[Boolean] and
356356
(__ \ "temperature").writeNullable[Double] and
357357
(__ \ "text").writeNullable[TextResponseConfig]
358-
)(unlift(CreateModelResponseSettingsAuxPart1.unapply))
358+
)(
359+
// somehow FineTuneJob.unapply is not working in Scala3
360+
(x: CreateModelResponseSettingsAuxPart1) =>
361+
(
362+
x.model,
363+
x.include,
364+
x.instructions,
365+
x.maxOutputTokens,
366+
x.metadata,
367+
x.parallelToolCalls,
368+
x.previousResponseId,
369+
x.reasoning,
370+
x.store,
371+
x.stream,
372+
x.temperature,
373+
x.text
374+
)
375+
)
359376

360377
private implicit lazy val createModelResponseSettingsAuxPart2Reads
361378
: Reads[CreateModelResponseSettingsAuxPart2] =
@@ -391,7 +408,25 @@ object JsonFormats {
391408
(__ \ "service_tier").writeNullable[String] and
392409
(__ \ "stream_options").writeNullable[StreamOptions] and
393410
(__ \ "top_logprobs").writeNullable[Int]
394-
)(unlift(CreateModelResponseSettingsAuxPart2.unapply))
411+
)(
412+
// somehow FineTuneJob.unapply is not working in Scala3
413+
(x: CreateModelResponseSettingsAuxPart2) =>
414+
(
415+
x.toolChoice,
416+
x.tools,
417+
x.topP,
418+
x.truncation,
419+
x.user,
420+
x.prompt,
421+
x.promptCacheKey,
422+
x.background,
423+
x.maxToolCalls,
424+
x.safetyIdentifier,
425+
x.serviceTier,
426+
x.streamOptions,
427+
x.topLogprobs
428+
)
429+
)
395430

396431
// Compose Reads and Writes for CreateModelResponseSettings using the AuxPart1 and AuxPart2
397432
implicit lazy val createModelResponseSettingsReads: Reads[CreateModelResponseSettings] =

0 commit comments

Comments
 (0)