Interface AiInvocationContext<T>

Type Parameters:
T - The expected return type of the method
All Known Implementing Classes:
DefaultAiInvocationContext

public interface AiInvocationContext<T>
AI The context interface for method proxy calls.

Encapsulates all context information for a method interception call. The framework intercepts a AiNode When modifying a method, the target object, method reference, input parameters and execution chain context are encapsulated in this interface and prepended/passed to the post-processor.

  • Method Details

    • getTarget

      Object getTarget()
      Get the currently proxied target object instance.
      Returns:
      target audience
    • getMethod

      Method getMethod()
      Get the reflection reference of the currently executing method.
      Returns:
      method reference
    • getArgs

      Object[] getArgs()
      Get the original parameter list passed to this method.
      Returns:
      method parameter array
    • getEnv

      Map<String,Object> getEnv()
      Get the currently executed set of mounted environment variables (context implicit data).
      Returns:
      Environment variable dictionary
    • getEnv

      Object getEnv(String key)
      Gets the value of a specific environment variable set in the context.
      Parameters:
      key - Environment variable name
      Returns:
      environment variable value
    • proceed

      T proceed() throws Exception
      Release the method call and execute the original Java Method implements logic.

      exist AI The processing chain can be interrupted by calling this method AI Take over and return to the native business code execution. And return the result calculated by the native code.

      Returns:
      Return value after native method execution
      Throws:
      Exception - Exceptions thrown during execution of native logic
    • getProceedResult

      Object getProceedResult()
      Get the return result of the target method execution (if it has been executed).
      Returns:
      The return value of the target method, which may be null
    • setProceedResult

      void setProceedResult(Object result)
      Set the return result of the target method execution.
      Parameters:
      result - Return results
    • getError

      Throwable getError()
      Gets the exception thrown during the execution of the target method (if any).
      Returns:
      the exception thrown, or if none null
    • setError

      void setError(Throwable error)
      Set the exception thrown during the execution of the target method.
      Parameters:
      error - abnormal
    • getAiOperations

      AiOperations getAiOperations()
      get AI Operation facade.
    • getAgentName

      String getAgentName()
      Get the logical name of the current agent.
      Returns:
      Agent logical name of
    • getAgentDescription

      String getAgentDescription()
      get Agent Functional description to assist reasoning.
      Returns:
      Agent describe
    • getAgentFallback

      String getAgentFallback()
      get Agent The name of the downgrade processing method.
      Returns:
      Downgrade processing method name
    • getModelName

      String getModelName()
      Get the preferred model name.
      Returns:
      The preferred model name, if not specified returns an empty string or null