Package com.embabel.agent.api.common
Class TemplateOperations
-
- All Implemented Interfaces:
public final class TemplateOperationsLlm 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 com.embabel.common.textio.template.TemplateRenderer provided.
-
-
Constructor Summary
Constructors Constructor Description TemplateOperations(String templateName, TemplateRenderer templateRenderer, PromptRunnerOperations promptRunnerOperations)
-
Method Summary
Modifier and Type Method Description final <T extends Any> TcreateObject(Class<T> outputClass, Map<String, Object> model)Create an object of the given type using the given model to render the template and LLM options from context final StringgenerateText(Map<String, Object> model)Generate text using the given model to render the template and LLM options from context final AssistantMessagerespondWithSystemPrompt(Conversation conversation, Map<String, Object> model)Respond in the conversation using the rendered template as system prompt. final AssistantMessagerespondWithSystemPrompt(Conversation conversation)Respond in the conversation using the rendered template as system prompt. -
-
Constructor Detail
-
TemplateOperations
TemplateOperations(String templateName, TemplateRenderer templateRenderer, PromptRunnerOperations promptRunnerOperations)
-
-
Method Detail
-
createObject
final <T extends Any> T createObject(Class<T> outputClass, Map<String, Object> model)
Create an object of the given type using the given model to render the template and LLM options from context
-
generateText
final String generateText(Map<String, Object> model)
Generate text using the given model to render the template and LLM options from context
-
respondWithSystemPrompt
@JvmOverloads() final AssistantMessage respondWithSystemPrompt(Conversation conversation, Map<String, Object> model)
Respond in the conversation using the rendered template as system prompt.
- Parameters:
conversation- the conversation so farmodel- the model to render the system prompt template with.
-
respondWithSystemPrompt
@JvmOverloads() final AssistantMessage respondWithSystemPrompt(Conversation conversation)
Respond in the conversation using the rendered template as system prompt.
- Parameters:
conversation- the conversation so far
-
-
-
-