Package com.aispect.api
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 Summary
Modifier and TypeMethodDescriptionget Agent Functional description to assist reasoning.get Agent The name of the downgrade processing method.Get the logical name of the current agent.get AI Operation facade.Object[]getArgs()Get the original parameter list passed to this method.getEnv()Get the currently executed set of mounted environment variables (context implicit data).Gets the value of a specific environment variable set in the context.getError()Gets the exception thrown during the execution of the target method (if any).Get the reflection reference of the currently executing method.Get the preferred model name.Get the return result of the target method execution (if it has been executed).Get the currently proxied target object instance.proceed()Release the method call and execute the original Java Method implements logic.voidSet the exception thrown during the execution of the target method.voidsetProceedResult(Object result) Set the return result of the target method execution.
-
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
Get the currently executed set of mounted environment variables (context implicit data).- Returns:
- Environment variable dictionary
-
getEnv
Gets the value of a specific environment variable set in the context.- Parameters:
key- Environment variable name- Returns:
- environment variable value
-
proceed
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
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
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
-