Interface LlmOperations
-
- All Implemented Interfaces:
public interface LlmOperationsWraps LLM operations. All user-initiated LLM operations go through this, allowing the AgentPlatform to mediate them. This interface is not directly for use in user code. Prefer PromptRunner An LlmOperations implementation is responsible for resolving all relevant tool callbacks for the current AgentProcess (in addition to those passed in directly), and emitting events.
-
-
Method Summary
Modifier and Type Method Description Stringgenerate(String prompt, LlmInteraction interaction, AgentProcess agentProcess, Action action)Generate text in the context of an AgentProcess. abstract <O extends Any> OcreateObject(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, AgentProcess agentProcess, Action action)Create an output object, in the context of an AgentProcess. abstract <O extends Any> Result<O>createObjectIfPossible(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, AgentProcess agentProcess, Action action)Try to create an output object in the context of an AgentProcess. <O extends Any> OdoTransform(String prompt, LlmInteraction interaction, Class<O> outputClass, LlmRequestEvent<O> llmRequestEvent)Low level transform, not necessarily aware of platform This is a convenience overload that creates a UserMessage from a String prompt abstract <O extends Any> OdoTransform(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, LlmRequestEvent<O> llmRequestEvent)Low level transform, not necessarily aware of platform -
-
Method Detail
-
generate
String generate(String prompt, LlmInteraction interaction, AgentProcess agentProcess, Action action)
Generate text in the context of an AgentProcess.
- Parameters:
prompt- Prompt to generate text frominteraction- Llm options and tool callbacks to use, plus unique identifieragentProcess- Agent process we are running withinaction- Action we are running within if we are running within an action
-
createObject
abstract <O extends Any> O createObject(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, AgentProcess agentProcess, Action action)
Create an output object, in the context of an AgentProcess.
- Parameters:
messages- messages in the conversation so far.interaction- Llm options and tool callbacks to use, plus unique identifieroutputClass- Class of the output objectagentProcess- Agent process we are running withinaction- Action we are running within if we are running within an action
-
createObjectIfPossible
abstract <O extends Any> Result<O> createObjectIfPossible(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, AgentProcess agentProcess, Action action)
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:
messages- messagesinteraction- Llm options and tool callbacks to use, plus unique identifieroutputClass- Class of the output objectagentProcess- Agent process we are running withinaction- Action we are running within if we are running within an action
-
doTransform
<O extends Any> O doTransform(String prompt, LlmInteraction interaction, Class<O> outputClass, LlmRequestEvent<O> llmRequestEvent)
Low level transform, not necessarily aware of platform This is a convenience overload that creates a UserMessage from a String prompt
- Parameters:
prompt- user prompt.interaction- The LLM call optionsoutputClass- Class of the output objectllmRequestEvent- Event already published for this request if one has been
-
doTransform
abstract <O extends Any> O doTransform(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, LlmRequestEvent<O> llmRequestEvent)
Low level transform, not necessarily aware of platform
- Parameters:
messages- messagesinteraction- The LLM call optionsoutputClass- Class of the output objectllmRequestEvent- Event already published for this request if one has been
-
-
-
-