-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves polymorphic serialization + tests (#561)
* Improves polymorphic serialization + tests * Completes the tests and models * Uses kotlin test runtime * Fixes compilation errors
- Loading branch information
1 parent
6a88611
commit 5d4f9e9
Showing
32 changed files
with
1,100 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
.../commonMain/kotlin/com/xebia/functional/openai/models/ext/assistant/AssistantToolsCode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.xebia.functional.openai.models.ext.assistant | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AssistantToolsCode(val type: Type) : AssistantTools { | ||
constructor() : this(Type.code_interpreter) | ||
|
||
@Serializable | ||
enum class Type(val value: String) { | ||
@SerialName(value = "code_interpreter") code_interpreter("code_interpreter"); | ||
|
||
override fun toString(): String { | ||
return value | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...monMain/kotlin/com/xebia/functional/openai/models/ext/assistant/AssistantToolsFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.xebia.functional.openai.models.ext.assistant | ||
|
||
import com.xebia.functional.openai.models.FunctionObject | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AssistantToolsFunction(val function: FunctionObject, val type: Type) : AssistantTools { | ||
constructor(function: FunctionObject) : this(function, Type.function) | ||
|
||
@Serializable | ||
enum class Type(val value: String) { | ||
@SerialName(value = "function") function("function") | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...onMain/kotlin/com/xebia/functional/openai/models/ext/assistant/AssistantToolsRetrieval.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.xebia.functional.openai.models.ext.assistant | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AssistantToolsRetrieval(val type: Type) : AssistantTools { | ||
constructor() : this(Type.retrieval) | ||
|
||
@Serializable | ||
enum class Type(val value: String) { | ||
@SerialName(value = "retrieval") retrieval("retrieval") | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...n/com/xebia/functional/openai/models/ext/assistant/RunStepDetailsMessageCreationObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.xebia.functional.openai.models.ext.assistant | ||
|
||
import com.xebia.functional.openai.models.RunStepDetailsMessageCreationObjectMessageCreation | ||
import kotlinx.serialization.Required | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RunStepDetailsMessageCreationObject( | ||
@SerialName(value = "message_creation") | ||
@Required | ||
val messageCreation: RunStepDetailsMessageCreationObjectMessageCreation, | ||
/* Always `message_creation``. */ | ||
@SerialName(value = "type") @Required val type: Type | ||
) : RunStepObjectStepDetails { | ||
|
||
constructor( | ||
messageCreation: RunStepDetailsMessageCreationObjectMessageCreation | ||
) : this(messageCreation, Type.message_creation) | ||
|
||
/** | ||
* Always `message_creation``. | ||
* | ||
* Values: message_creation | ||
*/ | ||
@Serializable | ||
enum class Type(val value: String) { | ||
@SerialName(value = "message_creation") message_creation("message_creation") | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../kotlin/com/xebia/functional/openai/models/ext/assistant/RunStepDetailsToolCallsObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.xebia.functional.openai.models.ext.assistant | ||
|
||
import com.xebia.functional.openai.models.RunStepDetailsToolCallsObjectToolCallsInner | ||
import kotlinx.serialization.Required | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RunStepDetailsToolCallsObject( | ||
|
||
/* An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. */ | ||
@SerialName(value = "tool_calls") | ||
@Required | ||
val toolCalls: List<RunStepDetailsToolCallsObjectToolCallsInner>, | ||
|
||
/* Always `tool_calls`. */ | ||
@SerialName(value = "type") @Required val type: Type = Type.tool_calls | ||
) : RunStepObjectStepDetails { | ||
|
||
constructor( | ||
toolCalls: List<RunStepDetailsToolCallsObjectToolCallsInner> | ||
) : this(toolCalls, Type.tool_calls) | ||
|
||
/** | ||
* Always `tool_calls`. | ||
* | ||
* Values: tool_calls | ||
*/ | ||
@Serializable | ||
enum class Type(val value: String) { | ||
@SerialName(value = "tool_calls") tool_calls("tool_calls") | ||
} | ||
} |
Oops, something went wrong.