in prompt/prompt-executor/prompt-executor-clients/prompt-executor-google-client/src/commonTest/kotlin/ai/koog/prompt/executor/clients/google/structure/GoogleSimpleJsonSchemaGeneratorTest.kt [76:158]
fun testGenerateGoogleSimpleJsonSchemaWeatherForecast() {
val result = simpleGenerator.generate(json, "WeatherForecast", serializer<WeatherForecast>(), emptyMap())
val schema = json.encodeToString(result.schema)
val expectedSchema = """
{
"type": "object",
"properties": {
"temperature": {
"type": "integer",
"description": "Temperature in Celsius"
},
"conditions": {
"type": "string",
"description": "Weather conditions (e.g., sunny, cloudy, rainy)"
},
"precipitation": {
"type": "integer",
"description": "Chance of precipitation in percentage",
"nullable": true
},
"latLon": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"description": "Latitude of the location"
},
"lon": {
"type": "number",
"description": "Longitude of the location"
}
},
"required": [
"lat",
"lon"
],
"description": "Coordinates of the location"
},
"pollution": {
"type": "string",
"enum": [
"None",
"LOW",
"MEDIUM",
"HIGH"
],
"description": "Pollution level"
},
"news": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Title of the news article"
},
"link": {
"type": "string",
"description": "Link to the news article"
}
},
"required": [
"title",
"link"
]
},
"description": "List of news articles"
}
},
"required": [
"temperature",
"precipitation",
"latLon",
"pollution",
"news"
]
}
""".trimIndent()
assertEquals(expectedSchema, schema)
}