File tree 2 files changed +32
-0
lines changed
openai-java-core/src/main/kotlin/com/openai/models
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1413,6 +1413,10 @@ constructor(
1413
1413
)
1414
1414
)
1415
1415
1416
+ /* * Messages sent by the model in response to user messages. */
1417
+ fun addMessage (chatCompletionAssistantMessageParam : ChatCompletionMessage ) =
1418
+ addMessage(chatCompletionAssistantMessageParam.toParam())
1419
+
1416
1420
/* *
1417
1421
* A list of messages comprising the conversation so far. Depending on the
1418
1422
* [model](https://platform.openai.com/docs/models) you use, different message types
@@ -2558,6 +2562,11 @@ constructor(
2558
2562
body.addMessage(chatCompletionAssistantMessageParam)
2559
2563
}
2560
2564
2565
+ /* * Messages sent by the model in response to user messages. */
2566
+ fun addMessage (chatCompletionAssistantMessageParam : ChatCompletionMessage ) = apply {
2567
+ body.addMessage(chatCompletionAssistantMessageParam)
2568
+ }
2569
+
2561
2570
/* *
2562
2571
* A list of messages comprising the conversation so far. Depending on the
2563
2572
* [model](https://platform.openai.com/docs/models) you use, different message types
Original file line number Diff line number Diff line change @@ -103,6 +103,29 @@ private constructor(
103
103
@ExcludeMissing
104
104
fun _additionalProperties (): Map <String , JsonValue > = additionalProperties
105
105
106
+ fun toParam (): ChatCompletionAssistantMessageParam =
107
+ ChatCompletionAssistantMessageParam .builder()
108
+ .role(_role ().map { ChatCompletionAssistantMessageParam .Role .of(it.toString()) })
109
+ .audio(
110
+ _audio ().map {
111
+ ChatCompletionAssistantMessageParam .Audio .builder().id(it._id ()).build()
112
+ }
113
+ )
114
+ .content(
115
+ _content ().map { ChatCompletionAssistantMessageParam .Content .ofTextContent(it) }
116
+ )
117
+ .functionCall(
118
+ _functionCall ().map {
119
+ ChatCompletionAssistantMessageParam .FunctionCall .builder()
120
+ .arguments(it._arguments ())
121
+ .name(it._name ())
122
+ .build()
123
+ }
124
+ )
125
+ .refusal(_refusal ())
126
+ .toolCalls(_toolCalls ())
127
+ .build()
128
+
106
129
private var validated: Boolean = false
107
130
108
131
fun validate (): ChatCompletionMessage = apply {
You can’t perform that action at this time.
0 commit comments