Skip to content

Commit 906c177

Browse files
committed
Enable JSON schema response format in CerebrasCreateChatCompletionJSON and enforce JSON schema mode.
1 parent 4d7a1c9 commit 906c177

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

openai-examples/src/main/scala/io/cequence/openaiscala/examples/cerebras/CerebrasCreateChatCompletionJSON.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ object CerebrasCreateChatCompletionJSON extends ExampleBase[OpenAIChatCompletion
4444

4545
private val modelId = NonOpenAIModelId.cerebras_llama_4_scout_17b_16e_instruct
4646

47-
// TODO: Cerebras should support JSON schema response format (without a conversion to "json mode")
4847
override protected def run: Future[_] =
4948
service
5049
.createChatCompletionWithJSON[JsObject](
@@ -59,8 +58,9 @@ object CerebrasCreateChatCompletionJSON extends ExampleBase[OpenAIChatCompletion
5958
strict = true,
6059
structure = jsonSchema
6160
)
62-
)
63-
).setMaxCompletionTokens(4000)
61+
),
62+
),
63+
enforceJsonSchemaMode = true
6464
)
6565
.map(json => println(Json.prettyPrint(json)))
6666
}

0 commit comments

Comments
 (0)