Skip to content

Commit 5337d7b

Browse files
committed
Actually fix format
1 parent 9b9b799 commit 5337d7b

File tree

1 file changed

+65
-13
lines changed
  • firebase-ai/src/main/kotlin/com/google/firebase/ai/type

1 file changed

+65
-13
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Part.kt

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,28 @@ import kotlinx.serialization.json.jsonObject
3131
import org.json.JSONObject
3232

3333
/** Interface representing data sent to and received from requests. */
34-
public interface Part {}
34+
public interface Part {
35+
public val isThought: Boolean
36+
}
3537

3638
/** Represents text or string based data sent to and received from requests. */
37-
public class TextPart(public val text: String) : Part {
39+
public class TextPart
40+
private constructor(public val text: String, public override val isThought: Boolean = false) :
41+
Part {
42+
43+
public constructor(text: String) : this(text, false)
3844

3945
@Serializable internal data class Internal(val text: String) : InternalPart
4046
}
4147

42-
public class CodeExecutionResultPart(public val outcome: String, public val output: String) : Part {
48+
public class CodeExecutionResultPart
49+
private constructor(
50+
public val outcome: String,
51+
public val output: String,
52+
public override val isThought: Boolean = false
53+
) : Part {
54+
55+
public constructor(outcome: String, output: String) : this(outcome, output, false)
4356

4457
@Serializable
4558
internal data class Internal(
@@ -54,7 +67,14 @@ public class CodeExecutionResultPart(public val outcome: String, public val outp
5467
}
5568
}
5669

57-
public class ExecutableCodePart(public val language: String, public val code: String) : Part {
70+
public class ExecutableCodePart
71+
private constructor(
72+
public val language: String,
73+
public val code: String,
74+
public override val isThought: Boolean = false
75+
) : Part {
76+
77+
public constructor(language: String, code: String) : this(language, code, false)
5878

5979
@Serializable
6080
internal data class Internal(@SerialName("executableCode") val executableCode: ExecutableCode) :
@@ -74,7 +94,11 @@ public class ExecutableCodePart(public val language: String, public val code: St
7494
*
7595
* @param image [Bitmap] to convert into a [Part]
7696
*/
77-
public class ImagePart(public val image: Bitmap) : Part {
97+
public class ImagePart
98+
private constructor(public val image: Bitmap, public override val isThought: Boolean = false) :
99+
Part {
100+
101+
public constructor(image: Bitmap) : this(image, false)
78102

79103
internal fun toInlineDataPart() =
80104
InlineDataPart(
@@ -90,7 +114,14 @@ public class ImagePart(public val image: Bitmap) : Part {
90114
* @param mimeType an IANA standard MIME type. For supported values, see the
91115
* [Vertex AI documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/send-multimodal-prompts#media_requirements)
92116
*/
93-
public class InlineDataPart(public val inlineData: ByteArray, public val mimeType: String) : Part {
117+
public class InlineDataPart
118+
private constructor(
119+
public val inlineData: ByteArray,
120+
public val mimeType: String,
121+
public override val isThought: Boolean = false
122+
) : Part {
123+
124+
public constructor(inlineData: ByteArray, mimeType: String) : this(inlineData, mimeType, false)
94125

95126
@Serializable
96127
internal data class Internal(@SerialName("inlineData") val inlineData: InlineData) :
@@ -110,13 +141,20 @@ public class InlineDataPart(public val inlineData: ByteArray, public val mimeTyp
110141
* have a matching `id` field.
111142
*/
112143
public class FunctionCallPart
113-
@JvmOverloads
114-
constructor(
144+
private constructor(
115145
public val name: String,
116146
public val args: Map<String, JsonElement>,
117-
public val id: String? = null
147+
public val id: String? = null,
148+
public override val isThought: Boolean = false
118149
) : Part {
119150

151+
@JvmOverloads
152+
public constructor(
153+
name: String,
154+
args: Map<String, JsonElement>,
155+
id: String? = null
156+
) : this(name, args, id, false)
157+
120158
@Serializable
121159
internal data class Internal(val functionCall: FunctionCall) : InternalPart {
122160

@@ -137,13 +175,20 @@ constructor(
137175
* @param id Matching `id` for a [FunctionCallPart], if one was provided.
138176
*/
139177
public class FunctionResponsePart
140-
@JvmOverloads
141-
constructor(
178+
private constructor(
142179
public val name: String,
143180
public val response: JsonObject,
144-
public val id: String? = null
181+
public val id: String? = null,
182+
public override val isThought: Boolean = false
145183
) : Part {
146184

185+
@JvmOverloads
186+
public constructor(
187+
name: String,
188+
response: JsonObject,
189+
id: String? = null
190+
) : this(name, response, id, false)
191+
147192
@Serializable
148193
internal data class Internal(val functionResponse: FunctionResponse) : InternalPart {
149194

@@ -168,7 +213,14 @@ constructor(
168213
* @param mimeType an IANA standard MIME type. For supported MIME type values see the
169214
* [Firebase documentation](https://firebase.google.com/docs/vertex-ai/input-file-requirements).
170215
*/
171-
public class FileDataPart(public val uri: String, public val mimeType: String) : Part {
216+
public class FileDataPart
217+
private constructor(
218+
public val uri: String,
219+
public val mimeType: String,
220+
public override val isThought: Boolean = false
221+
) : Part {
222+
223+
public constructor(uri: String, mimeType: String) : this(uri, mimeType, false)
172224

173225
@Serializable
174226
internal data class Internal(@SerialName("file_data") val fileData: FileData) : InternalPart {

0 commit comments

Comments
 (0)