All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.dashscope.tools.ToolCallBase Maven / Gradle / Ivy

The newest version!
package com.alibaba.dashscope.tools;

import java.util.HashMap;
import java.util.Map;
import lombok.Data;

/** base class of the tool call response. */
@Data
public abstract class ToolCallBase {
  private static final Map> toolCallRegistry = new HashMap<>();

  protected static synchronized void registerToolCall(
      String toolType, Class clazz) {
    toolCallRegistry.put(toolType, clazz);
  }

  public static synchronized Class getToolCallClass(String toolType) {
    return toolCallRegistry.get(toolType);
  }

  public static Map> getRegisteredTools() {
    return toolCallRegistry;
  }

  static {
    registerToolCall("function", ToolCallFunction.class);
  }

  public abstract String getType();

  public abstract String getId();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy