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

com.alibaba.dashscope.threads.ContentBase Maven / Gradle / Ivy

There is a newer version: 2.16.9
Show newest version
package com.alibaba.dashscope.threads;

import com.alibaba.dashscope.common.TypeRegistry;
import lombok.Data;

/** tool request base */
@Data
public abstract class ContentBase {
  private static final TypeRegistry contentRegistry = new TypeRegistry<>();

  protected static synchronized void registerContent(
      String type, Class clazz) {
    contentRegistry.register(type, clazz);
  }

  public static synchronized Class getContentClass(String type) {
    return contentRegistry.get(type);
  }

  // register official tools for list.
  static {
    registerContent("image_file", ContentImageFile.class);
    registerContent("text", ContentText.class);
  }

  public abstract String getType();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy