Interface OperationContext

  • All Implemented Interfaces:
    com.embabel.agent.core.Bindable , com.embabel.agent.core.Blackboard , com.embabel.agent.core.MayHaveLastResult , com.embabel.agent.core.ToolGroupConsumer , com.embabel.common.core.types.HasInfoString

    
    public interface OperationContext
     implements Blackboard, ToolGroupConsumer
                        

    Context for any operation. Exposes blackboard and process context.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      AgentPlatform agentPlatform()
      User user() Convenient way to get the user on whose behalf this operation is being executed, if any.
      <T extends Any> CompletableFuture<T> fireAgent(Object obj, Class<T> resultType) Any agents known to the present platform that can handle the given object and return the given result type.
      Ai ai() Get AI functionality for this context
      PromptRunner promptRunner(LlmOptions llm, Set<ToolGroupRequirement> toolGroups, List<ToolObject> toolObjects, List<PromptContributor> promptContributors, List<ContextualPromptElement> contextualPromptContributors, Boolean generateExamples) Create a prompt runner for this context.
      PromptRunner promptRunner() Create a prompt runner for this context that can be customized later.
      <T extends Any, R extends Any> List<R> parallelMap(Collection<T> items, Integer maxConcurrency, Function1<T, R> transform) Execute the operations in parallel.
      abstract ProcessContext getProcessContext()
      AgentProcess getAgentProcess()
      abstract Operation getOperation() Action or operation that is being executed.
      • Methods inherited from class com.embabel.agent.core.Blackboard

        clear, count, expressionEvaluationModel, get, getBlackboardId, getCondition, getObjects, getOrPut, getValue, hasValue, hide, last, lastResult, objectsOfType, setCondition, spawn
      • Methods inherited from class com.embabel.agent.core.Bindable

        addAll, addObject, bind, bindAll, bindProtected, plusAssign, plusAssign, plusAssign, set
      • Methods inherited from class com.embabel.common.core.types.HasInfoString

        infoString
      • Methods inherited from class com.embabel.agent.core.ToolGroupConsumer

        getToolGroups
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • user

         User user()

        Convenient way to get the user on whose behalf this operation is being executed, if any.

      • fireAgent

         <T extends Any> CompletableFuture<T> fireAgent(Object obj, Class<T> resultType)

        Any agents known to the present platform that can handle the given object and return the given result type. It is not an error if there are no such agents

      • ai

         Ai ai()

        Get AI functionality for this context

      • promptRunner

         PromptRunner promptRunner(LlmOptions llm, Set<ToolGroupRequirement> toolGroups, List<ToolObject> toolObjects, List<PromptContributor> promptContributors, List<ContextualPromptElement> contextualPromptContributors, Boolean generateExamples)

        Create a prompt runner for this context. Application code should always go through this method to run LLM operations.

        Parameters:
        llm - the LLM options to use
        toolGroups - extra local tool groups to use, in addition to those declared on the action if we're in an action
        promptContributors - extra prompt contributors to use, in addition to those declared on the action if we're in an action, or at agent level
      • promptRunner

         PromptRunner promptRunner()

        Create a prompt runner for this context that can be customized later. Principally for use from Java.

      • parallelMap

         <T extends Any, R extends Any> List<R> parallelMap(Collection<T> items, Integer maxConcurrency, Function1<T, R> transform)

        Execute the operations in parallel.

        Parameters:
        items - the collection of items to process
        maxConcurrency - the maximum number of concurrent operations to run
        transform - the transformation function to apply to each element