import com.volcengine.ark.runtime.model.completion.chat.ChatCompletionContentPart;
import com.volcengine.ark.runtime.model.completion.chat.ChatCompletionRequest;
import com.volcengine.ark.runtime.model.completion.chat.ChatMessage;
import com.volcengine.ark.runtime.model.completion.chat.ChatMessageRole;
import com.volcengine.ark.runtime.service.ArkService;
import java.util.ArrayList;
public static void main(String[] args) {
String apiKey = "请填写火山方舟 API Key/请填写 MediaKit API Key";
ArkService arkService = ArkService.builder().apiKey(apiKey).baseUrl("https://amk-ark.cn-beijing.volces.com").build();
final List<ChatMessage> messages = new ArrayList<>();
final List<ChatCompletionContentPart> multiContents = new ArrayList<>();
final ChatCompletionContentPart textPart = ChatCompletionContentPart.builder().type("text").text("总结描述视频的主要内容?").build();
multiContents.add(textPart);
final ChatCompletionContentPart.ChatCompletionContentPartVideoURL videoURL = new ChatCompletionContentPart.ChatCompletionContentPartVideoURL("https://ark-project.tos-cn-beijing.volces.com/doc_video/ark_vlm_video_input.mp4", 2.0);
final ChatCompletionContentPart videoPart = ChatCompletionContentPart.builder().type("video_url").videoUrl(videoURL).build();
multiContents.add(videoPart);
final ChatMessage userMessage1 = ChatMessage.builder().role(ChatMessageRole.USER).multiContent(multiContents).build();
messages.add(userMessage1);
ChatCompletionRequest chatCompletionRequest1 = ChatCompletionRequest.builder()
arkService.createChatCompletion(chatCompletionRequest1).getChoices().forEach(choice -> System.out.println(choice.getMessage().getContent()));
arkService.shutdownExecutor();