Skip to content

LLMDescription not included in the generated schema #178

@ionTea

Description

@ionTea

It seems to me like the JsonStructuredData schema doesn't actually contain the annotated data from @LLMDescription

For example this is what the result is when serializing an annotated class:

    @Serializable
    @LLMDescription("A simple data class for testing serialization")
    data class Hero(val name: String, val age: Int, @LLMDescription("The hero's superpower") val superpower: String)

    test("Serializing simple data") {
      val heroStructure =
        JsonStructuredData.createJsonStructure<Hero>(
          schemaFormat = JsonSchemaGenerator.SchemaFormat.Simple,
          schemaType = JsonStructuredData.JsonSchemaType.SIMPLE,
        )

      expectSelfie(serialize.encodeToString(heroStructure.schema))
        .toBe(
          """{
    "type": "ai.koog.prompt.params.LLMParams.Schema.JSON.Simple",
    "name": "Hero",
    "schema": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "age": {
                "type": "integer"
            },
            "superpower": {
                "type": "string"
            }
        },
        "required": [
            "name",
            "age",
            "superpower"
        ]
    }
}"""
        )
    }
  })

I would have expected the schema to be this:

{
    "type": "ai.koog.prompt.params.LLMParams.Schema.JSON.Simple",
    "name": "Hero",
    "description": "A simple data class for testing serialization", <----
    "schema": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "age": {
                "type": "integer"
            },
            "superpower": {
                "type": "string",
                "description": "The hero's superpower" <----
            }
        },
        "required": [
            "name",
            "age",
            "superpower"
        ]
    }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions