Class NacosPromptListener

java.lang.Object
io.agentscope.core.nacos.prompt.NacosPromptListener

public class NacosPromptListener extends Object
  • Constructor Details

    • NacosPromptListener

      public NacosPromptListener(com.alibaba.nacos.api.ai.AiService aiService)
  • Method Details

    • getPrompt

      public String getPrompt(String promptKey) throws com.alibaba.nacos.api.exception.NacosException
      Throws:
      com.alibaba.nacos.api.exception.NacosException
    • getPrompt

      public String getPrompt(String promptKey, Map<String,String> args) throws com.alibaba.nacos.api.exception.NacosException
      Throws:
      com.alibaba.nacos.api.exception.NacosException
    • getPrompt

      public String getPrompt(String promptKey, Map<String,String> args, String defaultValue) throws com.alibaba.nacos.api.exception.NacosException
      Get prompt template with optional default value.
      Parameters:
      promptKey - the prompt key
      args - the template variables for rendering
      defaultValue - the default value to use if prompt not found in Nacos
      Returns:
      rendered prompt string or default value
      Throws:
      com.alibaba.nacos.api.exception.NacosException - if Nacos service error occurs
    • getPrompt

      public String getPrompt(String promptKey, String version, String label, Map<String,String> args, String defaultValue) throws com.alibaba.nacos.api.exception.NacosException
      Get prompt template with version/label targeting and optional default value.
      Parameters:
      promptKey - the prompt key
      version - target prompt version (e.g. "1.0.0"), mutually exclusive with label
      label - target prompt label (e.g. "prod"), mutually exclusive with version
      args - the template variables for rendering
      defaultValue - the default value to use if prompt not found in Nacos
      Returns:
      rendered prompt string or default value
      Throws:
      com.alibaba.nacos.api.exception.NacosException - if Nacos service error occurs