Integration

We provide processor integration for OpenAI, CohereAI, and Minimax

以下是OpenAI chat completion的processor,而其他基于LLM Service的processor也大致相同

public class OpenAIChatProcessor implements Processor<MultiChatMessage, ChatMessage> {
  // OpenAiApi instance used for making requests
  private final OpenAIService openAIService;
  // Configuration for the OpenAI Chat Processor
  private final OpenAIChatProcessorConfig openAIChatProcessorConfig;

  @Inject
  public OpenAIChatProcessor(
      OpenAIService openAIService, OpenAIChatProcessorConfig openAIChatProcessorConfig) {
    this.openAIService = openAIService;
    this.openAIChatProcessorConfig = openAIChatProcessorConfig;
  }

  // Method to run the module with the given input and return the output chat message
  @Override
  public ChatMessage run(MultiChatMessage inputData) {}
  @Override
  public ListenableFuture<ChatMessage> runAsync(MultiChatMessage inputData) {}
  
}

One-time Initialization: Config + Service

query with input

Last updated