ObjectCreator

interface ObjectCreator<T>

Interface to create objects of the given type from a prompt or messages. Allows setting strongly typed examples.

Functions

Link copied to clipboard
abstract fun fromMessages(messages: List<Message>): T

Create an object of the desired typed from messages

Link copied to clipboard
open fun fromPrompt(prompt: String): T

Create an object of the desired type using the given prompt and LLM options from context (process context or implementing class). Prompts are typically created within the scope of an

Link copied to clipboard
abstract fun withExample(description: String, value: T): ObjectCreator<T>

Add an example of the desired output to the prompt. This will be included in JSON. It is possible to call this method multiple times. This will override PromptRunner.withGenerateExamples