TemplateOperations

class TemplateOperations(templateName: String, templateRenderer: <Error class: unknown class>, promptRunnerOperations: PromptRunnerOperations)

Llm operations based on a compiled template. Similar to PromptRunnerOperations, but taking a model instead of a template string. Template names will be resolved by the TemplateRenderer provided.

Constructors

Link copied to clipboard
constructor(templateName: String, templateRenderer: <Error class: unknown class>, promptRunnerOperations: PromptRunnerOperations)

Functions

Link copied to clipboard
fun <T> createObject(outputClass: Class<T>, model: Map<String, Any>): T

Create an object of the given type using the given model to render the template and LLM options from context

Link copied to clipboard
inline fun <T> TemplateOperations.createObject(model: Map<String, Any>): T
Link copied to clipboard

Generate text using the given model to render the template and LLM options from context

Link copied to clipboard
fun respondWithSystemPrompt(conversation: Conversation, model: Map<String, Any> = emptyMap()): AssistantMessage

Respond in the conversation using the rendered template as system prompt.