File tree 1 file changed +28
-0
lines changed
openai-examples/src/main/scala/io/cequence/openaiscala/examples/responsesapi
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .cequence .openaiscala .examples .responsesapi
2
+
3
+ import scala .concurrent .Future
4
+ import io .cequence .openaiscala .domain .responsesapi .Inputs
5
+ import io .cequence .openaiscala .domain .responsesapi .Input
6
+ import io .cequence .openaiscala .examples .Example
7
+
8
+ object CreateModelResponseForMessages extends Example {
9
+
10
+ override def run : Future [Unit ] =
11
+ service
12
+ .createModelResponse(
13
+ Inputs .Items (
14
+ Input .ofInputSystemTextMessage(
15
+ " You are a helpful assistant. Be verbose and detailed and don't be afraid to use emojis."
16
+ ),
17
+ Input .ofInputUserTextMessage(" What is the capital of France?" )
18
+ )
19
+ )
20
+ .map { response =>
21
+ import response .usage ._
22
+
23
+ println(response.outputText.getOrElse(" N/A" ))
24
+ println(inputTokens)
25
+ println(outputTokens)
26
+ println(totalTokens)
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments