@@ -109,11 +109,11 @@ private val defaultJson = Json {
109109/* *
110110 * Builds the system prompt with JSON schema injection.
111111 */
112- private fun buildSchemaSystemPrompt (userSystemPrompt : String? , schemaString : String ): String {
112+ private fun buildSchemaSystemPrompt (userSystemPrompt : String? , schema : String ): String {
113113 val basePrompt = userSystemPrompt?.let { " $it \n\n " } ? : " "
114114 return """
115115 |${basePrompt} You must respond in JSON format, strictly following this JSON Schema:
116- |$schemaString
116+ |$schema
117117 |
118118 |Output only valid JSON, do not include any other text, markdown code blocks, or explanations.
119119 """ .trimMargin()
@@ -170,7 +170,7 @@ private fun cleanJsonResponse(raw: String): String = raw
170170 * @Composable
171171 * fun RecipeGenerator() {
172172 * val (recipe, rawJson, isLoading, error, submit, stop) = useGenerateObject<Recipe>(
173- * schemaString = recipeSchema
173+ * schema = recipeSchema
174174 * ) {
175175 * provider = Providers.DeepSeek(apiKey = "your-api-key")
176176 * systemPrompt = "You are a professional chef."
@@ -188,16 +188,16 @@ private fun cleanJsonResponse(raw: String): String = raw
188188 * ```
189189 *
190190 * @param T The target data class type, must be @Serializable
191- * @param schemaString The JSON Schema string describing the expected output structure
191+ * @param schema The JSON Schema string describing the expected output structure
192192 * @param optionsOf Configuration factory function for options
193193 * @return GenerateObjectHolder containing object state and control functions
194194 */
195195@Composable
196196inline fun <reified T : Any > useGenerateObject (
197- schemaString : String ,
197+ schema : String ,
198198 noinline optionsOf : GenerateObjectOptions <T >.() -> Unit = {},
199199): GenerateObjectHolder <T > = useGenerateObject(
200- schemaString = schemaString ,
200+ schema = schema ,
201201 serializer = serializer<T >(),
202202 optionsOf = optionsOf,
203203)
@@ -209,14 +209,14 @@ inline fun <reified T : Any> useGenerateObject(
209209 * cannot be used.
210210 *
211211 * @param T The target data class type
212- * @param schemaString The JSON Schema string describing the expected output structure
212+ * @param schema The JSON Schema string describing the expected output structure
213213 * @param serializer The KSerializer for type T
214214 * @param optionsOf Configuration factory function for options
215215 * @return GenerateObjectHolder containing object state and control functions
216216 */
217217@Composable
218218fun <T : Any > useGenerateObject (
219- schemaString : String ,
219+ schema : String ,
220220 serializer : KSerializer <T >,
221221 optionsOf : GenerateObjectOptions <T >.() -> Unit = {},
222222): GenerateObjectHolder <T > {
@@ -229,8 +229,8 @@ fun <T : Any> useGenerateObject(
229229 val parseError = _useState <Throwable ?>(null )
230230
231231 // Build schema-injected system prompt
232- val schemaSystemPrompt = remember(schemaString , options.systemPrompt) {
233- buildSchemaSystemPrompt(options.systemPrompt, schemaString )
232+ val schemaSystemPrompt = remember(schema , options.systemPrompt) {
233+ buildSchemaSystemPrompt(options.systemPrompt, schema )
234234 }
235235
236236 // Use useChat internally
@@ -307,6 +307,6 @@ fun <T : Any> useGenerateObject(
307307 */
308308@Composable
309309inline fun <reified T : Any > rememberGenerateObject (
310- schemaString : String ,
310+ schema : String ,
311311 noinline optionsOf : GenerateObjectOptions <T >.() -> Unit = {},
312- ): GenerateObjectHolder <T > = useGenerateObject(schemaString , optionsOf)
312+ ): GenerateObjectHolder <T > = useGenerateObject(schema , optionsOf)
0 commit comments