createObjectIfPossible

open override fun <O> createObjectIfPossible(prompt: String, interaction: LlmInteraction, outputClass: Class<O>, agentProcess: AgentProcess, action: Action?): <Error class: unknown class><O>

Try to create an output object in the context of an AgentProcess. Return a failure result if the LLM does not have enough information to create the object.

Parameters

prompt

User prompt

interaction

Llm options and tool callbacks to use, plus unique identifier

outputClass

Class of the output object

agentProcess

Agent process we are running within

action

Action we are running within if we are running within an action

Throws

InvalidLlmReturnFormatException

if the LLM returns an object of the wrong type