looking through the docs, is there a way to map re...
# koog-agentic-framework
b
looking through the docs, is there a way to map responses from the LLM onto an object like in spring ai? https://docs.spring.io/spring-ai/reference/api/structured-output-converter.html#_using_converters
✅ 1
m
That sounds like Koog's structured output support.
b
the docs are infuriating
thanks
👍🏻 1
why return a string?
wasn't the original purpose to map it onto an object?
why is the input parameter ignored?
m
wasn't the original purpose to map it onto an object?
Yes,
getWeatherForecast
does that. It then forwards the structured result to
processResult
to generate a human-readable forecast from that structured output. Those are linked via
edge(getWeatherForecast forwardTo processResult)
as part of the overall agent strategy setup.
b
what's the point of the examples parameter?
m
It is used in the
JsonStructure.create()
call on the next line, to provide examples of properly-structured responses to the LLM. The hope is that these examples will increase the likelihood that the LLM will generate valid and useful JSON.
b
Copy code
forecastStructure
isn't used in the example I think
Copy code
val getWeatherForecast by nodeLLMRequestStructured<WeatherForecast>(
        name = "forecast-node",
        examples = exampleForecasts,
        fixingParser = StructureFixingParser(
            model = OpenAIModels.Chat.GPT4o,
            retries = 3
        )
    )
I suppose examples is converted by this call implicitly