L-Briand/KTM

missing leading `{` when rendering JSON string

Closed this issue ยท 5 comments

It seems the rendering logic has a bug when dealing with the following input:

       val prompt = """
            {
              "model": "{{{model}}}",
            }""".trimIndent()
        val p = prompt.render(
            mapOf( "model" to "staticValue1")
        )
        println(p)

The result prints:

  "model": "staticValue1",
}

The leading { is missing in the rendered result.

Hello @Zane-XY

Thanks for sharing, I've found the cause. I will patch it ASAP.

New version 1.0.2 should fix this issue. Can you please try ?

    implementation("net.orandja.ktm:core:1.0.2")

hi @L-Briand ,

i tried, it works for some cases, but not this one:

    @Test
    fun testMapContext() {
        val prompt = """
{ 
  "source":"{{{model}}}"
}
    """.trimIndent()
        val p = prompt.render(
            mapOf( "model" to "staticValue1")
        )
        println(p)
    }
}

@Zane-XY Thank you for the comeback. I'll look into it.

The issue should be fixed in the 1.0.3 version